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

Prefer interpretation of scoped as keyword whenever possible #62950

Open
jcouv opened this issue Jul 26, 2022 · 0 comments
Open

Prefer interpretation of scoped as keyword whenever possible #62950

jcouv opened this issue Jul 26, 2022 · 0 comments

Comments

@jcouv
Copy link
Member

jcouv commented Jul 26, 2022

The following should probably parse as two scoped modifiers.

We should also consider aligning the parser's behavior on scoped.nested a; (parsed as nested type) versus ref scoped.nested b; (error).

This issue is referenced in a couple of tests.

Relates to test plan #59194

        [Theory]
        [InlineData(LanguageVersion.CSharp10)]
        [InlineData(LanguageVersion.CSharp11)]
        public void Local_07_WithInitializer(LanguageVersion langVersion)
        {
            string source =
@"scoped scoped a = default;
";
            UsingTree(source, TestOptions.Regular.WithLanguageVersion(langVersion));

            N(SyntaxKind.CompilationUnit);
            {
                N(SyntaxKind.GlobalStatement);
                {
                    N(SyntaxKind.LocalDeclarationStatement);
                    {
                        N(SyntaxKind.ScopedKeyword);
                        N(SyntaxKind.VariableDeclaration);
                        {
                            N(SyntaxKind.IdentifierName);
                            {
                                N(SyntaxKind.IdentifierToken, "scoped");
                            }
                            N(SyntaxKind.VariableDeclarator);
                            {
                                N(SyntaxKind.IdentifierToken, "a");
                                N(SyntaxKind.EqualsValueClause);
                                {
                                    N(SyntaxKind.EqualsToken);
                                    N(SyntaxKind.DefaultLiteralExpression);
                                    {
                                        N(SyntaxKind.DefaultKeyword);
                                    }
                                }
                            }
                        }
                        N(SyntaxKind.SemicolonToken);
                    }
                }
                N(SyntaxKind.EndOfFileToken);
            }
            EOF();
        }
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Jul 26, 2022
@jcouv jcouv added this to the 17.4 milestone Jul 28, 2022
@jcouv jcouv removed the untriaged Issues and PRs which have not yet been triaged by a lead label Jul 28, 2022
@jaredpar jaredpar modified the milestones: 17.4, Backlog Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants