You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This by design and an intentional feature implementation.
Why? Because in the opposite scenario, imagine the following code:
letf1(x:string |null)=""letf2 x =lety= f1 x // x was infered to be nullable string
x.Length // suddenly, a nullness warning is returned on this line
Which is something I received many times when implementing nullness on this codebase itself for the fist time, before inference rules were changed.
There is a clear tradeoff between the two, and the decision is to make inference favour code that avoids nulls. And annotations have to be put in explicitly by users who want to allow nulls in, not vice versa.
This plays with the ideology at eliminating nullness as soon is it flows (typically via interop) into F#, not having it spread throughout F# codebase quickly.
Issue description
I expect NRT to be inferred just like other types, but nullness information is lost when automatic infer happens
Choose one or more from the following categories of impact
null
constructs 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
9.0.100-rc.1.24452.12
Reproducible code snippet and actual behavior
Possible workarounds
Specify explicit type signatures everywhere
The text was updated successfully, but these errors were encountered: