fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

Nullness - Consider supporting Nullable shorthand for TreatWarningsAsErrors

Open BoundedChenn31 opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe.

In C# it's possible to convert all nullable-related warnings to errors using <WarningsAsErrors>nullable</WarningsAsErrors>. From docs: The set of all nullability warnings can be specified with the Nullable shorthand.

So in line with https://github.com/dotnet/fsharp/pull/17486 it would be nice to have WAE behaviour as well.

Describe the solution you'd like

Support <WarningsAsErrors>nullable</WarningsAsErrors>

Describe alternatives you've considered

Just use specific warning numbers or even true.

Additional context

.

BoundedChenn31 avatar Aug 12 '24 21:08 BoundedChenn31

So the nullable would be a shorthand for putting in all nullness-related errors, on top of the option for specifying error codes individually.

Do I understand it right?

T-Gro avatar Aug 14 '24 16:08 T-Gro

So the nullable would be a shorthand for putting in all nullness-related errors, on top of the option for specifying error codes individually.

Do I understand it right?

Yeah, I think that's what C# does currently.

vzarytovskii avatar Aug 14 '24 16:08 vzarytovskii

So the nullable would be a shorthand for putting in all nullness-related errors, on top of the option for specifying error codes individually.

Do I understand it right?

Yes, not sure about implementation details (csc also supports /warnaserror:nullable option, so maybe it's handled completely by roslyn) but it definitely behaves like that and recommended as a solution:

SO: How to treat ALL C# 8 nullable reference warnings as errors? Roslyn 1: Provide single option to treat nullable issues as errors not warnings Roslyn 2: Proposal: Add switch for treating nullable-related warnings as errors

BoundedChenn31 avatar Aug 14 '24 17:08 BoundedChenn31

It's done, reopen if you still see it with F# 9

abonie avatar Sep 24 '24 17:09 abonie

This was not done, this proposal is about a syntactical shorthand for doing warningsAsErrors for all nullable-related warnings. (as opposed to listing individual error codes)

T-Gro avatar Sep 25 '24 06:09 T-Gro

I thought that we did it already for some reason

vzarytovskii avatar Sep 25 '24 12:09 vzarytovskii