[Proposal]: Flow analysis should handle indirect null check #4208
Replies: 2 comments 2 replies
-
Indirect flow analysis causes halting problem. There must be a limited pattern list that can be recognized. |
Beta Was this translation helpful? Give feedback.
-
That's not an accurate description here. My statement is essentially that:
As such the document does properly specify the behavior of this pattern because it's not explicitly listed as one of the supported constructs. At the same time I do agree this has been a source of confusion and it's something I intend to add in next time I update the spec.
The proposal needs to go deeper here though. It needs to get concrete on specifically:
These are the trickier parts of this feature that would need to be worked out and costed. |
Beta Was this translation helpful? Give feedback.
-
Flow analysis should detect chained null checks
Summary
Flow analysis should handle chained null checks and propagate the nullable state properly to all involved variables.
According to @jaredpar in dotnet/roslyn#49653 this is not properly specified in the language design.
Motivation
All other analyzers (e.g. R#, Sonar) handle this properly and complain about extra null checks that Roslyn nullability analyzer requires.
Detailed design
Expected Behavior:
No warning in
var c = a.ToString();
Actual Behavior:
CS8602
Drawbacks
Alternatives
Unresolved questions
Design meetings
Beta Was this translation helpful? Give feedback.
All reactions