-
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
Nullable analysis of yield return #31072
Changes from 8 commits
53d4e8a
5019025
ea0ac2a
875554c
c06f8af
d138c17
cc016e4
410272e
3965ca0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4592,6 +4592,20 @@ public override BoundNode VisitThrowExpression(BoundThrowExpression node) | |
return result; | ||
} | ||
|
||
public override BoundNode VisitYieldReturnStatement(BoundYieldReturnStatement node) | ||
{ | ||
BoundExpression expr = node.Expression; | ||
if (expr == null) | ||
{ | ||
return null; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Please add a test where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, it looks like I had forgotten to push the commit updating tests. There are already tests for this. I much prefer the behavior that avoids cascading diagnostics. We should discuss more. I filed a follow-up issue: #31121 #Resolved |
||
var method = (MethodSymbol)_member; | ||
Debug.Assert(method.IsIterator); | ||
TypeSymbolWithAnnotations elementType = InMethodBinder.GetIteratorElementTypeFromReturnType(compilation, binder: null, RefKind.None, method.ReturnType.TypeSymbol, errorLocationNode: null, diagnostics: null); | ||
VisitOptionalImplicitConversion(expr, elementType, useLegacyWarnings: false, AssignmentKind.Return); | ||
return null; | ||
} | ||
|
||
#endregion Visitors | ||
|
||
protected override string Dump(LocalState state) | ||
|
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.
Maybe split the ternary over three lines?