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
Copy file name to clipboardExpand all lines: test/Concurrency/transfernonsendable_ownership.swift
+8-10Lines changed: 8 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -35,12 +35,12 @@ struct CustomActor {
35
35
36
36
func testConsuming(_ x:consumingKlass)async{
37
37
awaittransferToMain(x) // expected-warning {{transferring 'x' may cause a race}}
38
-
// expected-note @-1 {{transferring nonisolated 'x' to main actor-isolated callee could cause races between main actor-isolated and nonisolated uses}}
38
+
// expected-note @-1 {{transferring task-isolated 'x' to main actor-isolated callee could cause races between main actor-isolated and task-isolated uses}}
39
39
}
40
40
41
41
func testConsumingError(_ x:consumingKlass)async{
42
42
awaittransferToMain(x) // expected-warning {{transferring 'x' may cause a race}}
43
-
// expected-note @-1 {{transferring nonisolated 'x' to main actor-isolated callee could cause races between main actor-isolated and nonisolated uses}}
43
+
// expected-note @-1 {{transferring task-isolated 'x' to main actor-isolated callee could cause races between main actor-isolated and task-isolated uses}}
func testConsumingUseAfterConsumeError(_ x:consumingKlass)async{ // expected-error {{'x' consumed more than once}}
54
54
awaitconsumeTransferToMain(x) // expected-warning {{transferring 'x' may cause a race}}
55
-
// expected-note @-1 {{transferring nonisolated 'x' to main actor-isolated callee could cause races between main actor-isolated and nonisolated uses}}
55
+
// expected-note @-1 {{transferring task-isolated 'x' to main actor-isolated callee could cause races between main actor-isolated and task-isolated uses}}
func testBorrowing(_ x:borrowingKlass)async{ // expected-note {{value is task-isolated since it is in the same region as 'x'}}
69
+
func testBorrowing(_ x:borrowingKlass)async{
70
70
awaittransferToMain(x) // expected-warning {{task-isolated value of type 'Klass' transferred to main actor-isolated context}}
71
71
}
72
72
73
73
func testBorrowingError(_ x:borrowingKlass)async{ // expected-error {{'x' is borrowed and cannot be consumed}}
74
-
// expected-note @-1 {{}}
75
74
awaittransferToMain(x) // expected-warning {{task-isolated value of type 'Klass' transferred to main actor-isolated context}}
76
75
print(x) // expected-note {{consumed here}}
77
76
}
78
77
79
78
@CustomActorfunc testBorrowingErrorGlobalActor(_ x:borrowingKlass)async{ // expected-error {{'x' is borrowed and cannot be consumed}}
80
-
// expected-note @-1 {{}}
81
-
awaittransferToMain(x) // expected-warning {{task-isolated value of type 'Klass' transferred to main actor-isolated context}}
79
+
awaittransferToMain(x) // expected-warning {{global actor 'CustomActor'-isolated value of type 'Klass' transferred to main actor-isolated context}}
82
80
print(x) // expected-note {{consumed here}}
83
81
}
84
82
85
83
func testInOut(_ x:inoutKlass)async{
86
84
awaittransferToMain(x) // expected-warning {{transferring 'x' may cause a race}}
87
85
// TODO: This is wrong. Should say task isolated!
88
-
// expected-note @-2 {{transferring nonisolated 'x' to main actor-isolated callee could cause races between main actor-isolated and nonisolated uses}}
86
+
// expected-note @-2 {{transferring task-isolated 'x' to main actor-isolated callee could cause races between main actor-isolated and task-isolated uses}}
89
87
}
90
88
91
89
func testInOutError(_ x:inoutKlass)async{
92
90
awaittransferToMain(x) // expected-warning {{transferring 'x' may cause a race}}
93
-
// expected-note @-1 {{transferring nonisolated 'x' to main actor-isolated callee}}
91
+
// expected-note @-1 {{transferring task-isolated 'x' to main actor-isolated callee}}
0 commit comments