Open marklam opened 1 month ago
Added a repo with the code https://github.com/marklam/Nullness
I will have a look.
A potential resolution, at least untill FsToolit.ErrorHandling is updated to make use of NRTs, is to offer an alternative option builder which would understand nullable reference types and offer non conflicting overloads.
The pre-nullness builder can bind either from option, or a from a type which was potentially nullable (the null generic constrain). With NRTs and full C#-interop, option must be considered as nullable too, because None is represented as null at runtime (and what interop gets to see). Which leads to a conflict of the two overloads, because both are possible.
This is also an example where a "betterness" resolution of overloads would be good (cc @vzarytovskii - a specific option overload winning over a generic one with a constraint), F# does not have it now.
Issue description
I found a couple of examples where type hints are needed inside the FsToolkit.ErrorHandling
option
CE with `--checknulls`` turned on.I'm providing some example code, and comments where the type hints need to be added. This compiles without the extra hints when `--checknulls`` is not specified.
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
No response