Skip to content

Commit ec554cd

Browse files
committed
Parser: avoid emitting disabled var diagnostics when building syntax tree
This is swift-5.1-branch only fix. The fix on master has been superseded by this pull request: #24594 rdar://52128292
1 parent 7e758f5 commit ec554cd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/Parse/ParseExpr.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,14 +2283,16 @@ Expr *Parser::parseExprIdentifier() {
22832283
if (D) {
22842284
for (auto activeVar : DisabledVars) {
22852285
if (activeVar == D) {
2286-
diagnose(loc.getBaseNameLoc(), DisabledVarReason);
2286+
if (!Context.LangOpts.BuildSyntaxTree)
2287+
diagnose(loc.getBaseNameLoc(), DisabledVarReason);
22872288
return new (Context) ErrorExpr(loc.getSourceRange());
22882289
}
22892290
}
22902291
} else {
22912292
for (auto activeVar : DisabledVars) {
22922293
if (activeVar->getFullName() == name) {
2293-
diagnose(loc.getBaseNameLoc(), DisabledVarReason);
2294+
if (!Context.LangOpts.BuildSyntaxTree)
2295+
diagnose(loc.getBaseNameLoc(), DisabledVarReason);
22942296
return new (Context) ErrorExpr(loc.getSourceRange());
22952297
}
22962298
}

0 commit comments

Comments
 (0)