You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[rbi] Simplify some logic that got confused so that passing an actor isolated value to a callee that is isolated ot the same actor is not considered a send.
The logic here got confused over time. This simplifies the logic and ensures
that we do not send a value if it is in the same isolation domain as the callee.
The one interesting side effect of this is that in a few tests, due to the logic
being confused, we were emitting use-after-send errors for global actor isolated
values that were passed to a function that was global actor isolated to the same
actor and then used later locally. The error was sending 'X'-isolated a to
'X'-isolated function causes race against nonisolated local uses. In truth, this
error is misleading and the only error that we should be emitting in such a case
is the error about moving an isolated value into a non-isolated context (which
we already emit).
rdar://132932382
Copy file name to clipboardExpand all lines: test/Concurrency/concurrent_value_checking.swift
+4-6Lines changed: 4 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -141,9 +141,8 @@ func globalTest() async {
141
141
// expected-warning@+2 {{expression is 'async' but is not marked with 'await'}}
142
142
// expected-note@+1 {{property access is 'async'}}
143
143
leta= globalValue // expected-warning{{non-sendable type 'NotConcurrent?' of let 'globalValue' cannot exit global actor 'SomeGlobalActor'-isolated context}}
144
-
awaitglobalAsync(a) // expected-tns-warning {{sending 'a' risks causing data races}}
145
-
// expected-tns-note @-1 {{sending global actor 'SomeGlobalActor'-isolated 'a' to global actor 'SomeGlobalActor'-isolated global function 'globalAsync' risks causing data races between global actor 'SomeGlobalActor'-isolated and local nonisolated uses}}
146
-
awaitglobalSync(a) // expected-tns-note {{access can happen concurrently}}
144
+
awaitglobalAsync(a)
145
+
awaitglobalSync(a)
147
146
148
147
// expected-warning@+2 {{expression is 'async' but is not marked with 'await'}}
149
148
// expected-note@+1 {{property access is 'async'}}
// expected-warning@+2 {{expression is 'async' but is not marked with 'await'}}
179
178
// expected-note@+1 {{property access is 'async'}}
180
179
leta= globalValue // expected-warning {{non-sendable type 'NotConcurrent?' of let 'globalValue' cannot exit global actor 'SomeGlobalActor'-isolated context}}
181
-
awaitglobalAsync(a) // expected-tns-warning {{sending 'a' risks causing data races}}
182
-
// expected-tns-note @-1 {{sending global actor 'SomeGlobalActor'-isolated 'a' to global actor 'SomeGlobalActor'-isolated global function 'globalAsync' risks causing data races between global actor 'SomeGlobalActor'-isolated and local main actor-isolated uses}}
183
-
awaitglobalSync(a) // expected-tns-note {{access can happen concurrently}}
180
+
awaitglobalAsync(a)
181
+
awaitglobalSync(a)
184
182
_ =awaitClassWithGlobalActorInits(nc)
185
183
// expected-tns-warning @-1 {{non-Sendable 'ClassWithGlobalActorInits'-typed result can not be returned from global actor 'SomeGlobalActor'-isolated initializer 'init(_:)' to main actor-isolated context}}
186
184
// expected-tns-warning @-2 {{sending 'nc' risks causing data races}}
0 commit comments