Skip to content

Commit 9953b1e

Browse files
authored
Merge pull request #84553 from rintaro/parser-recover-stmtlevel
[ASTGen] Update for UnexpectedCodeDeclSyntax addition
2 parents 25a1e42 + 7a4b7aa commit 9953b1e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/ASTGen/Sources/ASTGen/Decls.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ extension ASTGenVisitor {
6767
return self.generate(subscriptDecl: node).asDecl
6868
case .typeAliasDecl(let node):
6969
return self.generate(typeAliasDecl: node)?.asDecl
70+
case .unexpectedCodeDecl:
71+
// Ignore unexpected code.
72+
return nil
7073
case .variableDecl(let node):
7174
return self.generate(variableDecl: node)
7275
case .usingDecl(let node):

test/ASTGen/if_config_expr.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func testInvalidContent(baseExpr: MyStruct, otherExpr: Int) {
4646

4747
baseExpr // expected-warning {{expression of type 'MyStruct' is unused}}
4848
#if CONDITION_1
49-
+ otherExpr // expected-error {{unexpected code '+ otherExpr' in conditional compilation block}}
49+
+ otherExpr // expected-error {{unexpected code '+ otherExpr' in conditional compilation clause}}
5050
#endif
5151

5252
baseExpr

0 commit comments

Comments
 (0)