Issue description
I get a nullness warning with the following:
let dispose (x: IDisposable | null) : unit =
match x with
| null -> ()
| d -> d.Dispose()
let useThing (thing: #IDisposable) =
try
printfn "%O" thing
finally
dispose thing // warning generated
Since the dispose function allows null, I do not think a warning should be generated. No warning is generated for a non-flexible type, e.g.:
let useThing (thing: IDisposable) =
try
printfn "%O" thing
finally
dispose thing // no warning generated
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
net9.0
Reproducible code snippet and actual behavior
No response
Possible workarounds
No response
Issue description
I get a nullness warning with the following:
Since the dispose function allows null, I do not think a warning should be generated. No warning is generated for a non-flexible type, e.g.:
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
net9.0
Reproducible code snippet and actual behavior
No response
Possible workarounds
No response