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
useValue(x) // expected-note {{access here could race}}
26
26
}
27
27
28
-
functestArgumentError(_ x:NonSendableType)async{ // expected-note {{value is task isolated since it is in the same region as 'x'}}
28
+
functestTransferArgumentError(_ x:NonSendableType)async{ // expected-note {{value is task isolated since it is in the same region as 'x'}}
29
29
awaittransferToMain(x) // expected-error {{task isolated value of type 'NonSendableType' transferred to main actor-isolated context; later accesses to value could race}}
transferValue(x) // expected-error {{task isolated value of type 'NonSendableType' passed as a strongly transferred parameter; later accesses could race}}
x = y // expected-error {{call site passes `self` or a non-sendable argument of this function to another thread, potentially yielding a race with the caller}}
44
+
}
45
+
46
+
func testIsolationCrossingDueToCapture()async{
47
+
letx=NonSendableType()
48
+
let _ ={@MainActorin
49
+
print(x) // expected-error {{main actor-isolated closure captures value of non-Sendable type 'NonSendableType' from nonisolated context; later accesses to value could race}}
50
+
}
51
+
useValue(x) // expected-note {{access here could race}}
print(x) // expected-error {{task isolated value of type 'NonSendableType' transferred to main actor-isolated context; later accesses to value could race}}
0 commit comments