Issue description
The following code triggers FS3261:
let blip =
match true with
| true -> null
| false -> "test"
with blip being inferred as type string. The above should reasonably be inferred as string | null, and I believe the equivalent of the above using if / then / else does indeed do that.
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 9
Reproducible code snippet and actual behavior
let blip =
match true with
| true -> null
| false -> "test"
Possible workarounds
Add a type annotation on blip e.g. blip : string | null.
Issue description
The following code triggers FS3261:
with
blipbeing inferred as typestring. The above should reasonably be inferred asstring | null, and I believe the equivalent of the above usingif/then/elsedoes indeed do that.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 9
Reproducible code snippet and actual behavior
Possible workarounds
Add a type annotation on
blipe.g.blip : string | null.