Issue description
Currently compiler can't unify null and string into single string | null type and gives misleading error in the place where there are no nulls:
Program.fs(2, 24): [FS3261] Nullness warning: The type 'string' does not support 'null'.
Ideally compiler would be able to unify cases, or provide better error message, or underline the null case rather than the non-nullable string.
Choose one or more from the following categories of impact
Operating System
Windows (Default)
What .NET runtime/SDK kind are you seeing the issue on
.NET SDK (.NET Core, .NET 5+)
.NET Runtime/SDK version
.NET 10.0.202
Reproducible code snippet and actual behavior
let test x =
match x with
| null -> ()
| "" -> ()
| _ -> ()
Possible workarounds
Manually specify type
let test (x: string | null) =
match x with
| null -> ()
| "" -> ()
| _ -> ()
Issue description
Currently compiler can't unify
nullandstringinto singlestring | nulltype and gives misleading error in the place where there are no nulls:Program.fs(2, 24): [FS3261] Nullness warning: The type 'string' does not support 'null'.Ideally compiler would be able to unify cases, or provide better error message, or underline the
nullcase rather than the non-nullable string.Choose one or more from the following categories of impact
nullconstructs in code not using the checknulls switch.null,not null).Operating System
Windows (Default)
What .NET runtime/SDK kind are you seeing the issue on
.NET SDK (.NET Core, .NET 5+)
.NET Runtime/SDK version
.NET 10.0.202
Reproducible code snippet and actual behavior
Possible workarounds
Manually specify type