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
awaittransferToMain(x) // expected-warning {{transferring 'x' may cause a race}}
49
+
// expected-note @-1 {{transferring global actor 'CustomActor'-isolated 'x' to main actor-isolated callee could cause races between main actor-isolated and global actor 'CustomActor'-isolated uses}}
50
+
print(x)
51
+
}
52
+
53
+
func testConsumingUseAfterConsumeError(_ x:consumingKlass)async{ // expected-error {{'x' consumed more than once}}
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}}
56
+
// expected-note @-2 {{consumed here}}
57
+
print(x)
58
+
// expected-note @-1 {{consumed again here}}
59
+
}
60
+
61
+
@CustomActorfunc testConsumingUseAfterConsumeErrorGlobalActor(_ x:consumingKlass)async{ // expected-error {{'x' consumed more than once}}
62
+
awaitconsumeTransferToMain(x) // expected-warning {{transferring 'x' may cause a race}}
63
+
// expected-note @-1 {{transferring global actor 'CustomActor'-isolated 'x' to main actor-isolated callee could cause races between main actor-isolated and global actor 'CustomActor'-isolated uses}}
64
+
// expected-note @-2 {{consumed here}}
65
+
print(x)
66
+
// expected-note @-1 {{consumed again here}}
67
+
}
68
+
69
+
func testBorrowing(_ x:borrowingKlass)async{ // expected-note {{value is task-isolated since it is in the same region as 'x'}}
70
+
awaittransferToMain(x) // expected-warning {{task-isolated value of type 'Klass' transferred to main actor-isolated context}}
71
+
}
72
+
73
+
func testBorrowingError(_ x:borrowingKlass)async{ // expected-error {{'x' is borrowed and cannot be consumed}}
74
+
// expected-note @-1 {{}}
75
+
awaittransferToMain(x) // expected-warning {{task-isolated value of type 'Klass' transferred to main actor-isolated context}}
76
+
print(x) // expected-note {{consumed here}}
77
+
}
78
+
79
+
@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}}
82
+
print(x) // expected-note {{consumed here}}
83
+
}
84
+
85
+
func testInOut(_ x:inoutKlass)async{
86
+
awaittransferToMain(x) // expected-warning {{transferring 'x' may cause a race}}
87
+
// 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}}
89
+
}
90
+
91
+
func testInOutError(_ x:inoutKlass)async{
92
+
awaittransferToMain(x) // expected-warning {{transferring 'x' may cause a race}}
93
+
// expected-note @-1 {{transferring nonisolated 'x' to main actor-isolated callee}}
0 commit comments