Skip to content

Commit 9656057

Browse files
committed
Consume the try token as if it was a throws.
1 parent eeb0a1f commit 9656057

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/Parse/ParsePattern.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -782,14 +782,10 @@ Parser::parseFunctionSignature(Identifier SimpleName,
782782
} else if (Tok.is(tok::kw_rethrows)) {
783783
throwsLoc = consumeToken();
784784
rethrows = true;
785-
} else if (Tok.is(tok::kw_throw)) {
785+
} else if (Tok.isAny(tok::kw_throw, tok::kw_try)) {
786786
throwsLoc = consumeToken();
787787
diagnose(throwsLoc, diag::throw_in_function_type)
788788
.fixItReplace(throwsLoc, "throws");
789-
} else if (Tok.is(tok::kw_try)) {
790-
SourceLoc tryLoc = consumeToken();
791-
diagnose(tryLoc, diag::throw_in_function_type)
792-
.fixItReplace(tryLoc, "throws");
793789
}
794790

795791
SourceLoc arrowLoc;

0 commit comments

Comments
 (0)