-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dataflow analysis thinks that we could get back in a loop with null
node
#26624
Comments
💡 it took me a bit to realize what happened when I reviewed this on a small screen. It would help to also comment the line that ensures |
This looks like a variant of #25870. |
The problem still seems to be there after the null-conditional access has been fixed.
|
The issue may be comparing with something other than static void M(string? s)
{
if (s?.Length != null) s.ToString();
if (s?.Length > 0) s.ToString(); // warning
} |
Tagging @333fred FYI |
Yes, the propagation only runs as part of comparisons to null. We need to change that. |
Closing as duplicate of #31906 (Infer nullability of receiver from |
Update:
A test like
c?.Count > 0
should tell us thatc
is not-null in the when-true branch.Found in nullable dogfood.
Tagging @cston
The text was updated successfully, but these errors were encountered: