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 @@ -1747,17 +1747,19 @@ bool Parser::canParseNonisolatedAsTypeModifier() {
1747
1747
if (Tok.isAtStartOfLine ())
1748
1748
return false ;
1749
1749
1750
- // Always requires `(<<argument>>)`
1751
- if (!Tok.is (tok::l_paren))
1750
+ // Always requires `(nonsending)`, together
1751
+ // we don't want eagerly interpret something
1752
+ // like `nonisolated(0)` as a modifier.
1753
+
1754
+ if (!consumeIf (tok::l_paren))
1752
1755
return false ;
1753
1756
1754
- // Consume argument list
1755
- skipSingle () ;
1757
+ if (!Tok. isContextualKeyword ( " nonsending " ))
1758
+ return false ;
1756
1759
1757
- // if consumed '(...)' ended up being followed
1758
- // by `[async, throws, ...] -> ...` this means
1759
- // the `nonisolated` is invalid as a modifier.
1760
- return !isAtFunctionTypeArrow ();
1760
+ consumeToken ();
1761
+
1762
+ return consumeIf (tok::r_paren);
1761
1763
}
1762
1764
1763
1765
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