-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Handle new extension foreach nullability #79319
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
Conversation
|
Done with review pass (commit 5) #Closed |
nit: consider leaving assertions that Refers to: src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs:11685 in e09ff76. [](commit_id = e09ff76, deletion_comment = False) |
| s = null; | ||
|
|
||
| var c = M(s); // 'C<string?>' | ||
| foreach (var x in c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Consider also covering the happy case where IEnumerator<string> is inferred/returned
| } | ||
| }"; | ||
| var verifier = CompileAndVerify(source, expectedOutput: "23", parseOptions: TestOptions.RegularPreview.WithFeature("run-nullable-analysis", "never")); // Tracked by https://github.com/dotnet/roslyn/issues/78828: Nullable analysis asserts | ||
| var verifier = CompileAndVerify(source, expectedOutput: "23", parseOptions: TestOptions.RegularPreview); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could remove RegularPreview since it's the default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with review pass (commit 5)
I think this will be covered by a future change which adds an assertion to |
…ethodAndVisitArguments
| """; | ||
| var comp = CreateCompilation(src); | ||
| CompileAndVerify(comp, expectedOutput: "42").VerifyDiagnostics(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Consider adding a test like foreach (var x in M(null)) where the receiver of GetEnumerator produces a warning (only once).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't follow what you meant by M(null). But, I added a version of the GetEnumerator test with a null receiver and classic extension method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant a test where we have a nullability warning in the receiver of GetEnumerator, showing that we only report that warning once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks (commit 8)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 9)
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Related to #78828