Skip to content

Commit 8df09a0

Browse files
committed
Remove unnecessary check for a single closure.
At an earlier point, we were doing this check after parsing the labeled closures, but that never made much sense, since it's a good diagnostic regardless.
1 parent 1e1e7f3 commit 8df09a0

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/Parse/ParseExpr.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3186,13 +3186,11 @@ Parser::parseTrailingClosures(bool isExprBasic, SourceRange calleeRange,
31863186
diagnose(braceLoc, diag::trailing_closure_after_newlines);
31873187
diagnose(calleeRange.Start, diag::trailing_closure_callee_here);
31883188

3189-
if (closures.size() == 1) {
3190-
auto *CE = dyn_cast<ClosureExpr>(closures[0].ClosureExpr);
3191-
if (CE && CE->hasAnonymousClosureVars() &&
3192-
CE->getParameters()->size() == 0) {
3193-
diagnose(braceLoc, diag::brace_stmt_suggest_do)
3194-
.fixItInsert(braceLoc, "do ");
3195-
}
3189+
auto *CE = dyn_cast<ClosureExpr>(closures[0].ClosureExpr);
3190+
if (CE && CE->hasAnonymousClosureVars() &&
3191+
CE->getParameters()->size() == 0) {
3192+
diagnose(braceLoc, diag::brace_stmt_suggest_do)
3193+
.fixItInsert(braceLoc, "do ");
31963194
}
31973195
}
31983196

0 commit comments

Comments
 (0)