From 7a4b7aa92a18c7eef5dcd64f5fe903aa54406a50 Mon Sep 17 00:00:00 2001 From: Rintaro Ishizaki Date: Sat, 27 Sep 2025 12:04:09 -0700 Subject: [PATCH] [ASTGen] Update for UnexpectedCodeDeclSyntax addition --- lib/ASTGen/Sources/ASTGen/Decls.swift | 3 +++ test/ASTGen/if_config_expr.swift | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ASTGen/Sources/ASTGen/Decls.swift b/lib/ASTGen/Sources/ASTGen/Decls.swift index 4fc9d279cdcd9..e40626542e8e5 100644 --- a/lib/ASTGen/Sources/ASTGen/Decls.swift +++ b/lib/ASTGen/Sources/ASTGen/Decls.swift @@ -67,6 +67,9 @@ extension ASTGenVisitor { return self.generate(subscriptDecl: node).asDecl case .typeAliasDecl(let node): return self.generate(typeAliasDecl: node)?.asDecl + case .unexpectedCodeDecl: + // Ignore unexpected code. + return nil case .variableDecl(let node): return self.generate(variableDecl: node) case .usingDecl(let node): diff --git a/test/ASTGen/if_config_expr.swift b/test/ASTGen/if_config_expr.swift index 32b5c2bd33cb2..11c92997ca4cd 100644 --- a/test/ASTGen/if_config_expr.swift +++ b/test/ASTGen/if_config_expr.swift @@ -46,7 +46,7 @@ func testInvalidContent(baseExpr: MyStruct, otherExpr: Int) { baseExpr // expected-warning {{expression of type 'MyStruct' is unused}} #if CONDITION_1 - + otherExpr // expected-error {{unexpected code '+ otherExpr' in conditional compilation block}} + + otherExpr // expected-error {{unexpected code '+ otherExpr' in conditional compilation clause}} #endif baseExpr