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
varbox=TwoFieldKlassBox() // expected-tns-note {{variable defined here}}
611
611
box =TwoFieldKlassBox()
612
612
613
613
// This transfers the entire region.
614
-
awaittransferToMain(box.k1) // expected-tns-warning {{transferring value of non-Sendable type 'NonSendableKlass' from nonisolated context to main actor-isolated context; later accesses could race}}
615
-
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableKlass' into main actor-isolated context may introduce data races}}
614
+
awaittransferToMain(box.k1) // expected-tns-warning {{transferring 'box.k1' may cause a race}}
615
+
// expected-tns-note @-1 {{'box.k1' is transferred from nonisolated caller to main actor-isolated callee}}
616
+
// expected-complete-warning @-2 {{passing argument of non-sendable type 'NonSendableKlass' into main actor-isolated context may introduce data races}}
616
617
617
618
618
619
// So even if we reassign over k1, since we did a merge, this should error.
varbox=(NonSendableKlass(),NonSendableKlass()) // expected-tns-note {{variable defined here}}
651
652
box =(NonSendableKlass(),NonSendableKlass())
652
653
653
654
// This transfers the entire region.
654
-
awaittransferToMain(box.0) // expected-tns-warning {{transferring value of non-Sendable type 'NonSendableKlass' from nonisolated context to main actor-isolated context; later accesses could race}}
655
-
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableKlass' into main actor-isolated context may introduce data races}}
655
+
awaittransferToMain(box.0) // expected-tns-warning {{transferring 'box.0' may cause a race}}
656
+
// expected-tns-note @-1 {{'box.0' is transferred from nonisolated caller to main actor-isolated callee}}
657
+
// expected-complete-warning @-2 {{passing argument of non-sendable type 'NonSendableKlass' into main actor-isolated context may introduce data races}}
656
658
657
659
// So even if we reassign over k1, since we did a merge, this should error.
658
660
box.0=NonSendableKlass() // expected-tns-note {{access here could race}}
0 commit comments