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() {
1749
1749
if (Tok.isAtStartOfLine ())
1750
1750
return false ;
1751
1751
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))
1754
1757
return false ;
1755
1758
1756
- // Consume argument list
1757
- skipSingle () ;
1759
+ if (!Tok. isContextualKeyword ( " nonsending " ))
1760
+ return false ;
1758
1761
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);
1763
1765
}
1764
1766
1765
1767
bool Parser::canParseTypeScalar () {
Original file line number Diff line number Diff line change 77
77
78
78
_ = [ nonisolated ( ) ]
79
79
}
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