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