File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -1749,17 +1749,19 @@ bool Parser::canParseNonisolatedAsTypeModifier() {
17491749 if (Tok.isAtStartOfLine ())
17501750 return false ;
17511751
1752- // Always requires `(<<argument>>)`
1753- if (!Tok.is (tok::l_paren))
1752+ // Always requires `(nonsending)`, together
1753+ // we don't want eagerly interpret something
1754+ // like `nonisolated(0)` as a modifier.
1755+
1756+ if (!consumeIf (tok::l_paren))
17541757 return false ;
17551758
1756- // Consume argument list
1757- skipSingle () ;
1759+ if (!Tok. isContextualKeyword ( " nonsending " ))
1760+ return false ;
17581761
1759- // if consumed '(...)' ended up being followed
1760- // by `[async, throws, ...] -> ...` this means
1761- // the `nonisolated` is invalid as a modifier.
1762- return !isAtFunctionTypeArrow ();
1762+ consumeToken ();
1763+
1764+ return consumeIf (tok::r_paren);
17631765}
17641766
17651767bool Parser::canParseTypeScalar () {
Original file line number Diff line number Diff line change 7777
7878 _ = [ nonisolated ( ) ]
7979}
80+
81+ do {
82+ func nonisolated( _: Int ) -> Int { 42 }
83+
84+ nonisolated ( 0 ) // expected-warning {{result of call to 'nonisolated' is unused}}
85+ print ( " hello " )
86+ }
You can’t perform that action at this time.
0 commit comments