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
First of all, I absolutely love this library. I really appreciate your work on it :)
I ran into a case today where I had refactored some code that previously had not allowed null to be a valid value, but now I have switch cases throwing ExhaustiveMatch.Failed. I realized it was because I had not been handling the null case in the switch.
In the documentation, I see you have the following:
Since C# reference types are always nullable, but may be intended to never be null, exhaustiveness checking does not require a case for null. If a null value is expected it can be handled by a case null:. The analyzer will ignore this case for its analysis.
For nullable enum types, the analyzer requires that there be a case null: to handle the null value.
I understand that this might not be desired as a default behavior, but I would really personally like to be forced to handle null on reference types.
Is there any way that we can see this as an opt-in thing in the future? Perhap something we can decorate our assembly with as an attribute, or similar.
Thank you!
Anthony
The text was updated successfully, but these errors were encountered:
I think this is a good idea and should probably be implemented in concert with #27 "Support C# 8 Nullable Reference Types" to make sure that it plays well with that.
Hello!
First of all, I absolutely love this library. I really appreciate your work on it :)
I ran into a case today where I had refactored some code that previously had not allowed
null
to be a valid value, but now I haveswitch
cases throwingExhaustiveMatch.Failed
. I realized it was because I had not been handling thenull
case in theswitch
.In the documentation, I see you have the following:
I understand that this might not be desired as a default behavior, but I would really personally like to be forced to handle
null
on reference types.Is there any way that we can see this as an opt-in thing in the future? Perhap something we can decorate our assembly with as an attribute, or similar.
Thank you!
Anthony
The text was updated successfully, but these errors were encountered: