Skip to content

Commit b157368

Browse files
committed
[region-isolation] Update some tests unrelated to transferring that emit better diagnostics given the new support I added for VariableNameInference.
1 parent 02be75a commit b157368

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/Concurrency/transfernonsendable.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -607,12 +607,13 @@ func singleFieldVarMergeTest() async {
607607
}
608608

609609
func multipleFieldVarMergeTest1() async {
610-
var box = TwoFieldKlassBox()
610+
var box = TwoFieldKlassBox() // expected-tns-note {{variable defined here}}
611611
box = TwoFieldKlassBox()
612612

613613
// This transfers the entire region.
614-
await transferToMain(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+
await transferToMain(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}}
616617

617618

618619
// So even if we reassign over k1, since we did a merge, this should error.
@@ -647,12 +648,13 @@ func multipleFieldVarMergeTest2() async {
647648
}
648649

649650
func multipleFieldTupleMergeTest1() async {
650-
var box = (NonSendableKlass(), NonSendableKlass())
651+
var box = (NonSendableKlass(), NonSendableKlass()) // expected-tns-note {{variable defined here}}
651652
box = (NonSendableKlass(), NonSendableKlass())
652653

653654
// This transfers the entire region.
654-
await transferToMain(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+
await transferToMain(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}}
656658

657659
// So even if we reassign over k1, since we did a merge, this should error.
658660
box.0 = NonSendableKlass() // expected-tns-note {{access here could race}}

0 commit comments

Comments
 (0)