File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -601,6 +601,11 @@ ParserResult<Stmt> Parser::parseStmt() {
601
601
LLVM_FALLTHROUGH;
602
602
default :
603
603
diagnose (Tok, tryLoc.isValid () ? diag::expected_expr : diag::expected_stmt);
604
+ if (Tok.is (tok::at_sign)) {
605
+ // Recover from erroneously placed attribute.
606
+ consumeToken (tok::at_sign);
607
+ consumeIf (tok::identifier);
608
+ }
604
609
return nullptr ;
605
610
case tok::kw_return:
606
611
if (LabelInfo) diagnose (LabelInfo.Loc , diag::invalid_label_on_stmt);
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -parse -verify %s
2
+
3
+ func test1( ) {
4
+ @s // expected-error {{expected statement}}
5
+ return
6
+ }
7
+ func test2( ) {
8
+ @unknown // expected-error {{expected statement}}
9
+ return
10
+ }
You can’t perform that action at this time.
0 commit comments