-
Notifications
You must be signed in to change notification settings - Fork 844
Labels
Area-NullnessIssues related to handling of Nullable Reference TypesIssues related to handling of Nullable Reference TypesBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone
Description
Please provide a succinct description of the issue.
Repro steps
Enable nullable.
type T () =
let mutable v : T | null = null
member val P : T | null = null with get, set
member this.M() =
v <- null
this.P <- null
let mutable v can assign null as expected.
But member val P cannot assign null, it causes FS3261.
Expected behavior
compile it successfully.
Actual behavior
It causes FS3261 warning.
Program.fs(6,19): warning FS3261: Nullness warning: The types 'T' and 'T | null' do not have compatible nullability.
Known workarounds
Use Uncheked.defaultof<T | null>.
Related information
Provide any related information (optional):
- Windows 11
- .NET 9 RC1
- Visual Studio Professional Preview 17.12.0 Preview 2.0
Metadata
Metadata
Assignees
Labels
Area-NullnessIssues related to handling of Nullable Reference TypesIssues related to handling of Nullable Reference TypesBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Type
Projects
Status
Done