File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1745,6 +1745,31 @@ bool Parser::isStartOfDecl() {
1745
1745
if (Tok.is (tok::kw_try))
1746
1746
return peekToken ().isAny (tok::kw_let, tok::kw_var);
1747
1747
1748
+ // Look through attribute list, because it may be an *type* attribute list.
1749
+ if (Tok.is (tok::at_sign)) {
1750
+ BacktrackingScope backtrack (*this );
1751
+ while (consumeIf (tok::at_sign)) {
1752
+ // If not identifier or code complete token, consider '@' is a incomplete
1753
+ // attribute.
1754
+ if (Tok.isNot (tok::identifier, tok::code_complete))
1755
+ continue ;
1756
+ consumeToken ();
1757
+ // Eat paren after attribute name; e.g. @foo(x)
1758
+ if (consumeIf (tok::l_paren)) {
1759
+ while (Tok.isNot (tok::r_brace, tok::eof, tok::pound_endif)) {
1760
+ if (consumeIf (tok::r_paren)) break ;
1761
+ skipSingle ();
1762
+ }
1763
+ }
1764
+ }
1765
+ // If this attribute is the last element in the block,
1766
+ // consider it is a start of incomplete decl.
1767
+ if (Tok.isAny (tok::r_brace, tok::eof, tok::pound_endif))
1768
+ return true ;
1769
+
1770
+ return isStartOfDecl ();
1771
+ }
1772
+
1748
1773
// Otherwise, the only hard case left is the identifier case.
1749
1774
if (Tok.isNot (tok::identifier)) return true ;
1750
1775
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ A<[[A<B>]]>.c()
43
43
A< ( Int, UnicodeScalar) > . c( )
44
44
A< ( a: Int, b: UnicodeScalar) > . c( )
45
45
A< Runcible & Fungible> . c( )
46
+ A < @convention ( c) ( ) -> Int32 > . c ( )
47
+ A < ( @autoclosure @escaping ( ) -> Int , Int ) -> Void > . c ( )
46
48
47
49
A < B > ( x: 0 ) // expected-warning{{unused}}
48
50
You can’t perform that action at this time.
0 commit comments