Skip to content
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

Enforce new grammar rules that scoped keyword must be immediately followed by a type possibly “prefixed” by ref/ref readonly/in/out. #64088

Merged
merged 2 commits into from
Sep 19, 2022

Conversation

@AlekseyTs
Copy link
Contributor Author

@cston, @dotnet/roslyn-compiler Please review

1 similar comment
@AlekseyTs
Copy link
Contributor Author

@cston, @dotnet/roslyn-compiler Please review

{
if (this.CurrentToken.ContextualKind == SyntaxKind.ScopedKeyword)
if (this.CurrentToken.Kind is SyntaxKind.RefKeyword or SyntaxKind.OutKeyword or SyntaxKind.InKeyword)
Copy link
Member

@cston cston Sep 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)

or SyntaxKind.ReadOnlyKeyword perhaps? #WontFix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or SyntaxKind.ReadOnlyKeyword perhaps?

That is not needed for any valid scenario. And it is really questionable if that would add any value for an error scenario. Going as is for now.

@AlekseyTs
Copy link
Contributor Author

https://github.com/orgs/dotnet/teams/roslyn-compiler For the second review

@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review

@RikkiGibson RikkiGibson self-assigned this Sep 19, 2022
@@ -9827,6 +9845,14 @@ private StatementSyntax ParseLocalDeclarationStatement(SyntaxList<AttributeListS
var variables = _pool.AllocateSeparated<VariableDeclaratorSyntax>();
try
{
SyntaxToken scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter: false);

// For local functions, 'scoped' is a modifier in LocalFunctionStatementSyntax
Copy link
Contributor

@RikkiGibson RikkiGibson Sep 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is an error reported if a local function has the scoped modifier? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is an error reported if a local function has the scoped modifier?

Yes. There is a test for that. ReturnTypeScope in RefFieldTest.cs, for example.

@AlekseyTs AlekseyTs merged commit 1f8b9e9 into dotnet:main Sep 19, 2022
@ghost ghost added this to the Next milestone Sep 19, 2022
@Cosifne Cosifne modified the milestones: Next, 17.4 P3 Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants