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
%6 = apply [caller_isolation=nonisolated] [callee_isolation=actor_instance] %5(%4) : $@convention(method) @async (@guaranteed NonSendableKlass) -> () // expected-warning {{taskisolated value of type 'NonSendableKlass' transferred to actor-isolated context; later accesses to value could race}}
285
+
%6 = apply [caller_isolation=nonisolated] [callee_isolation=actor_instance] %5(%4) : $@convention(method) @async (@guaranteed NonSendableKlass) -> () // expected-warning {{task-isolated value of type 'NonSendableKlass' transferred to actor-isolated context; later accesses to value could race}}
Copy file name to clipboardExpand all lines: test/Concurrency/transfernonsendable.swift
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -213,25 +213,25 @@ extension Actor {
213
213
// expected-tns-note @-3 {{transferring actor-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and actor-isolated uses}}
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type '(Int, () -> ())' into main actor-isolated context may introduce data races}}
223
223
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
224
-
// expected-tns-warning @-2 {{taskisolated value of type '(Int, () -> ())' transferred to main actor-isolated context}}
224
+
// expected-tns-warning @-2 {{task-isolated value of type '(Int, () -> ())' transferred to main actor-isolated context}}
awaittransferToMain(x) // expected-tns-warning {{taskisolated value of type '(() -> (), Int)' transferred to main actor-isolated context}}
234
+
awaittransferToMain(x) // expected-tns-warning {{task-isolated value of type '(() -> (), Int)' transferred to main actor-isolated context}}
235
235
// expected-complete-warning @-1 {{passing argument of non-sendable type '(() -> (), Int)' into main actor-isolated context may introduce data races}}
236
236
// expected-complete-note @-2 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
237
237
}
@@ -1366,26 +1366,26 @@ actor ActorWithSetter {
1366
1366
varrecursive:ActorWithSetter?=nil
1367
1367
varclassBox=TwoFieldKlassClassBox()
1368
1368
1369
-
// TODO: Why is this taskisolated? This should be actor isolated?
1369
+
// TODO: Why is this task-isolated? This should be actor isolated?
1370
1370
func test1()async{
1371
1371
letx=NonSendableKlass()
1372
1372
self.field = x
1373
1373
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type 'NonSendableKlass' into main actor-isolated context may introduce data races}}
1374
-
// expected-tns-warning @-1 {{taskisolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1374
+
// expected-tns-warning @-1 {{task-isolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1375
1375
}
1376
1376
1377
1377
func test2()async{
1378
1378
letx=NonSendableKlass()
1379
1379
self.twoFieldBox.k1 = x
1380
1380
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type 'NonSendableKlass' into main actor-isolated context may introduce data races}}
1381
-
// expected-tns-warning @-1 {{taskisolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1381
+
// expected-tns-warning @-1 {{task-isolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1382
1382
}
1383
1383
1384
1384
func test3()async{
1385
1385
letx=NonSendableKlass()
1386
1386
self.twoFieldBoxInTuple.1.k1 = x
1387
1387
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type 'NonSendableKlass' into main actor-isolated context may introduce data races}}
1388
-
// expected-tns-warning @-1 {{taskisolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1388
+
// expected-tns-warning @-1 {{task-isolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1389
1389
}
1390
1390
1391
1391
// This triggers a crash in SILGen with tns enabled.
@@ -1405,7 +1405,7 @@ actor ActorWithSetter {
1405
1405
letx=NonSendableKlass()
1406
1406
self.classBox.k1 = x
1407
1407
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type 'NonSendableKlass' into main actor-isolated context may introduce data races}}
1408
-
// expected-tns-warning @-1 {{taskisolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1408
+
// expected-tns-warning @-1 {{task-isolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1409
1409
}
1410
1410
}
1411
1411
@@ -1420,21 +1420,21 @@ final actor FinalActorWithSetter {
1420
1420
letx=NonSendableKlass()
1421
1421
self.field = x
1422
1422
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type 'NonSendableKlass' into main actor-isolated context may introduce data races}}
1423
-
// expected-tns-warning @-1 {{taskisolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1423
+
// expected-tns-warning @-1 {{task-isolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1424
1424
}
1425
1425
1426
1426
func test2()async{
1427
1427
letx=NonSendableKlass()
1428
1428
self.twoFieldBox.k1 = x
1429
1429
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type 'NonSendableKlass' into main actor-isolated context may introduce data races}}
1430
-
// expected-tns-warning @-1 {{taskisolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1430
+
// expected-tns-warning @-1 {{task-isolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1431
1431
}
1432
1432
1433
1433
func test3()async{
1434
1434
letx=NonSendableKlass()
1435
1435
self.twoFieldBoxInTuple.1.k1 = x
1436
1436
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type 'NonSendableKlass' into main actor-isolated context may introduce data races}}
1437
-
// expected-tns-warning @-1 {{taskisolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1437
+
// expected-tns-warning @-1 {{task-isolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1438
1438
}
1439
1439
1440
1440
// This triggers a crash in SILGen with tns enabled.
@@ -1454,12 +1454,12 @@ final actor FinalActorWithSetter {
1454
1454
letx=NonSendableKlass()
1455
1455
self.classBox.k1 = x
1456
1456
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type 'NonSendableKlass' into main actor-isolated context may introduce data races}}
1457
-
// expected-tns-warning @-1 {{taskisolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
1457
+
// expected-tns-warning @-1 {{task-isolated value of type 'NonSendableKlass' transferred to main actor-isolated context}}
// TODO: This should say global actor isolated isolated.
52
-
awaittransferToMainActor(x) // expected-tns-warning {{taskisolated value of type 'NonSendableLinkedList<Int>' transferred to main actor-isolated context}}
52
+
awaittransferToMainActor(x) // expected-tns-warning {{task-isolated value of type 'NonSendableLinkedList<Int>' transferred to main actor-isolated context}}
53
53
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableLinkedList<Int>' into main actor-isolated context may introduce data races}}
54
54
55
55
lety= secondList.listHead!.next!
56
56
57
-
awaittransferToMainActor(y) // expected-tns-warning {{taskisolated value of type 'NonSendableLinkedListNode<Int>' transferred to main actor-isolated context}}
57
+
awaittransferToMainActor(y) // expected-tns-warning {{task-isolated value of type 'NonSendableLinkedListNode<Int>' transferred to main actor-isolated context}}
58
58
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableLinkedListNode<Int>' into main actor-isolated context may introduce data races}}
// TODO: This should be a global actor isolated error, not a taskisolated error.
144
-
awaittransferToNonIsolated(x) // expected-tns-warning {{taskisolated value of type '(NonSendableLinkedList<Int>, NonSendableLinkedList<Int>)' transferred to nonisolated context}}
143
+
// TODO: This should be a global actor isolated error, not a task-isolated error.
144
+
awaittransferToNonIsolated(x) // expected-tns-warning {{task-isolated value of type '(NonSendableLinkedList<Int>, NonSendableLinkedList<Int>)' transferred to nonisolated context}}
145
145
// expected-complete-warning @-1 {{passing argument of non-sendable type '(NonSendableLinkedList<Int>, NonSendableLinkedList<Int>)' outside of global actor 'GlobalActor'-isolated context may introduce data races}}
146
146
// expected-complete-warning @-2 {{passing argument of non-sendable type '(NonSendableLinkedList<Int>, NonSendableLinkedList<Int>)' outside of global actor 'GlobalActor'-isolated context may introduce data races}}
awaittransferToCustom(globalKlass) // expected-warning {{taskisolated value of type 'Klass' transferred to global actor 'CustomActor'-isolated context}}
43
+
awaittransferToCustom(globalKlass) // expected-warning {{task-isolated value of type 'Klass' transferred to global actor 'CustomActor'-isolated context}}
// expected-note @-1 {{value is taskisolated since it is in the same region as 'k'}}
52
+
// expected-note @-1 {{value is task-isolated since it is in the same region as 'k'}}
53
53
globalKlass = k
54
-
awaittransferToCustom(k) // expected-warning {{taskisolated value of type 'Klass' transferred to global actor 'CustomActor'-isolated context; later accesses to value could race}}
54
+
awaittransferToCustom(k) // expected-warning {{task-isolated value of type 'Klass' transferred to global actor 'CustomActor'-isolated context; later accesses to value could race}}
0 commit comments