File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1457,4 +1457,4 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-02-a: ddd2b2976aa9bfde5f20fe37f6bd2
1457
1457
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-03-a: 171cc166f2abeb5ca2a4003700a8a78a108bd300
1458
1458
refs/heads/benlangmuir-patch-1: baaebaf39d52f3bf36710d4fe40cf212e996b212
1459
1459
refs/heads/i-do-redeclare: 8c4e6d5de5c1e3f0a2cedccf319df713ea22c48e
1460
- refs/heads/master-rebranch: ee810d21dfc09e4e445cb6a6d70b55060b465c7b
1460
+ refs/heads/master-rebranch: 9e87e491c68a514f48741d9ba249f677ef83eace
Original file line number Diff line number Diff line change 17
17
#include " swift/Parse/Parser.h"
18
18
19
19
#include " swift/AST/ASTVisitor.h"
20
+ #include " swift/AST/DiagnosticSuppression.h"
20
21
#include " swift/Basic/Defer.h"
21
22
#include " swift/Basic/LangOptions.h"
22
23
#include " swift/Basic/Version.h"
@@ -638,6 +639,12 @@ ParserResult<IfConfigDecl> Parser::parseIfConfig(
638
639
SmallVector<ASTNode, 16 > Elements;
639
640
if (isActive || !isVersionCondition) {
640
641
parseElements (Elements, isActive);
642
+ } else if (SyntaxContext->isEnabled ()) {
643
+ // We shouldn't skip code if we are building syntax tree.
644
+ // The parser will keep running and we just discard the AST part.
645
+ DiagnosticSuppression suppression (Context.Diags );
646
+ SmallVector<ASTNode, 16 > dropedElements;
647
+ parseElements (dropedElements, false );
641
648
} else {
642
649
DiagnosticTransaction DT (Diags);
643
650
skipUntilConditionalBlockClose ();
Original file line number Diff line number Diff line change @@ -19,3 +19,10 @@ class { // expected-error {{unknown declaration syntax exists in the source}}
19
19
// expected-error@-4 {{top-level statement cannot begin with a closure expression}}
20
20
21
21
}
22
+
23
+ #if swift(<1)
24
+ print ( " Wat " )
25
+ class { // expected-error {{unknown declaration syntax exists in the source}}
26
+
27
+ }
28
+ #endif
You can’t perform that action at this time.
0 commit comments