Repository: dotnet/roslyn
File: src/Compilers/CSharp/Test/Syntax/Parsing/AwaitParsingTests.cs (C#)

Code before:
                                        }
                                        N(SyntaxKind.CloseBraceToken);
                                    }
                                }
                                N(SyntaxKind.SemicolonToken);
                            }
                            N(SyntaxKind.CloseBraceToken);
                        }
                    }
                    N(SyntaxKind.CloseBraceToken);
                }
                N(SyntaxKind.EndOfFileToken);
            }
        }

        [Fact]
        public void NestedAnonymousMethodAwait()
        {
            UsingTree("""
                class C
                {
                    void f()
                    {
                        async delegate () {
                            await 1;
                            async delegate () {
                                int await;
                            };
                        };
                    }
                }
                """,
                // (8,21): error CS4003: 'await' cannot be used as an identifier within an async method or lambda expression
                //                 int await;
                Diagnostic(ErrorCode.ERR_BadAwaitAsIdentifier, "await").WithLocation(8, 21));

            N(SyntaxKind.CompilationUnit);
            {
                N(SyntaxKind.ClassDeclaration);
                {
                    N(SyntaxKind.ClassKeyword);
                    N(SyntaxKind.IdentifierToken, "C");
                    N(SyntaxKind.OpenBraceToken);
                    N(SyntaxKind.MethodDeclaration);
                    {
                        N(SyntaxKind.PredefinedType);
                        {
                            N(SyntaxKind.VoidKeyword);
                        }
                        N(SyntaxKind.IdentifierToken, "f");
                        N(SyntaxKind.ParameterList);

Review comment (suggestion):
```suggestion
                            delegate () {
```

Code after:
                                        }
                                        N(SyntaxKind.CloseBraceToken);
                                    }
                                }
                                N(SyntaxKind.SemicolonToken);
                            }
                            N(SyntaxKind.CloseBraceToken);
                        }
                    }
                    N(SyntaxKind.CloseBraceToken);
                }
                N(SyntaxKind.EndOfFileToken);
            }
        }

        [Fact]
        public void NestedAnonymousMethodAwait()
        {
            UsingTree("""
                class C
                {
                    void f()
                    {
                        async delegate () {
                            await 1;
                            delegate () {
                                int await;
                            };
                        };
                    }
                }
                """,
                // (8,21): error CS4003: 'await' cannot be used as an identifier within an async method or lambda expression
                //                 int await;
                Diagnostic(ErrorCode.ERR_BadAwaitAsIdentifier, "await").WithLocation(8, 21));

            N(SyntaxKind.CompilationUnit);
            {
                N(SyntaxKind.ClassDeclaration);
                {
                    N(SyntaxKind.ClassKeyword);
                    N(SyntaxKind.IdentifierToken, "C");
                    N(SyntaxKind.OpenBraceToken);
                    N(SyntaxKind.MethodDeclaration);
                    {
                        N(SyntaxKind.PredefinedType);
                        {
                            N(SyntaxKind.VoidKeyword);
                        }
                        N(SyntaxKind.IdentifierToken, "f");
                        N(SyntaxKind.ParameterList);