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
The 'not struct' is already automatically emitted in IL for any code that uses 'null' constraint.
Also the constraints are automatically inferred when consuming functions that require it.
The exposure to this issue should be therefore limited to code which uses explicit annotation of type parameters, and does not use their automatic inference from called functions.
That being said, I think we do have a precedence where comparison implies equality.
The constraint will be for sure there (it's needed by design), but it could be implied in the case of explicit typar constraints.
This code works with FSharp.Core 8.0.100:
In FSharp.Core 9.0.100, it does not compile:
The
null
constraint should surely already implynot struct
? The docs at https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/generics/constraints say "This [not null] generic constraint does allow value types, since those can never be null.", which suggests that thenull
constraint logically implies thenot struct
constraint.Repro steps
Thing.fsproj
Thing.fs
Observe the compile error; then downgrade FSharp.Core to 8.0.100 and observe the compile success.
Known workarounds
not struct
.Provide a description of any known workarounds.
Related information
I'm using SDK 9.0.200 on linux-x64.
The text was updated successfully, but these errors were encountered: