-
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
Support scoped
keyword in for
statement.
#64154
Conversation
else | ||
{ | ||
this.EatToken(); | ||
isDeclaration = ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken; |
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.
code below uses 'IsTrueIdentifier', any concern about this direct .IdentifierToken check? #Resolved
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.
code below uses 'IsTrueIdentifier', any concern about this direct .IdentifierToken check?
I don't think so. I think that, at most, that can affect how we parse error scenarios and I am fine to prioritize scoped type for now.
decl = decl.Update( | ||
CheckFeatureAvailability(decl.Type, MessageID.IDS_FeatureRefFor), | ||
decl.Variables); | ||
decl = decl.Update(declType, decl.Variables); |
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 just do the update no matter what. it will already test that the type actually changed before updating. #WontFix
@cston, @RikkiGibson, @dotnet/roslyn-compiler Please review |
@RikkiGibson, @dotnet/roslyn-compiler For the second review |
{ | ||
var source = | ||
@"for (scoped s1 = default;;) { | ||
for (ref scoped s2 = ref s1;;) {break;} // 1 |
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.
consider indenting to make the nesting clear. Also, it looks like there is no diagnostic given on this line. #Resolved
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.
it looks like there is no diagnostic given on this line.
The same as in the test above. Comments aren't there to convey any expectations. They are there to make it easier to map baseline to the source. Expectations are set by baselines.
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.
Will address indenting in the next PR
Related to #62039.
https://github.com/dotnet/csharplang/blob/main/proposals/low-level-struct-improvements.md#syntax