File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2755,8 +2755,11 @@ ParserResult<Expr> Parser::parseExprClosure() {
2755
2755
2756
2756
// Parse the closing '}'.
2757
2757
SourceLoc rightBrace;
2758
- parseMatchingToken (tok::r_brace, rightBrace, diag::expected_closure_rbrace,
2759
- leftBrace);
2758
+ bool missingRBrace = parseMatchingToken (tok::r_brace, rightBrace,
2759
+ diag::expected_closure_rbrace,
2760
+ leftBrace);
2761
+ if (missingRBrace)
2762
+ Status.setIsParseError ();
2760
2763
2761
2764
// If we didn't have any parameters, create a parameter list from the
2762
2765
// anonymous closure arguments.
@@ -2784,7 +2787,8 @@ ParserResult<Expr> Parser::parseExprClosure() {
2784
2787
// may be incomplete and the type mismatch in return statement will just
2785
2788
// confuse the type checker.
2786
2789
bool hasSingleExpressionBody = false ;
2787
- if (!Status.hasCodeCompletion () && bodyElements.size () == 1 ) {
2790
+ if (!missingRBrace && !Status.hasCodeCompletion () &&
2791
+ bodyElements.size () == 1 ) {
2788
2792
// If the closure's only body element is a single return statement,
2789
2793
// use that instead of creating a new wrapping return expression.
2790
2794
Expr *returnExpr = nullptr ;
You can’t perform that action at this time.
0 commit comments