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
[region-isolation] Only make partial_apply actor derived if we capture an isolated parameter... not just any actor.
Before I couldn't do this since, @sil_isolated was not represented on
partial_applies. Since in the previous commit, I added support to the compiler
to represent this, I can now limit this query so now one can pass an actor
instance outside of its method to a nonisolated non-Sendable partial apply.
Since it is Sendable, it is always safe to do this since we are passing the
actor.
rdar://123881277
awaittransferToMain(actorCaptureClosure) // expected-complete-warning {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
197
197
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
198
-
// expected-tns-warning @-2 {{transferring 'actorCaptureClosure' may cause a race}}
199
-
// expected-tns-note @-3 {{transferring nonisolated 'actorCaptureClosure' to main actor-isolated callee could cause races between main actor-isolated and nonisolated uses}}
200
198
201
199
actorCaptureClosure ={print(a)}
202
200
awaittransferToMain(actorCaptureClosure) // expected-complete-warning {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
203
201
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
204
-
// expected-tns-warning @-2 {{transferring 'actorCaptureClosure' may cause a race}}
205
-
// expected-tns-note @-3 {{transferring nonisolated 'actorCaptureClosure' to main actor-isolated callee could cause races between main actor-isolated and nonisolated uses}}
awaittransferToMain(closure) // expected-complete-warning {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
405
401
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
406
-
// expected-tns-warning @-2 {{transferring 'closure' may cause a race}}
407
-
// expected-tns-note @-3 {{transferring nonisolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and nonisolated uses}}
awaittransferToMain(closure) // expected-complete-warning {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
443
437
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
444
-
// expected-tns-warning @-2 {{transferring 'closure' may cause a race}}
445
-
// expected-tns-note @-3 {{transferring nonisolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and nonisolated uses}}
0 commit comments