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
awaitself.klass.asyncCall() // expected-complete-warning {{passing argument of non-sendable type 'NonSendableKlass' outside of actor-isolated context may introduce data races}}
85
87
// expected-tns-warning @-1 {{transferring 'self.klass' may cause a data race}}
// expected-tns-note @-3 {{transferring disconnected 'ns0' to actor-isolated callee could cause races in between callee actor-isolated and local nonisolated uses}}
164
166
165
167
// We only emit a warning on the first use we see, so make sure we do both
166
-
// the print and the closure.
168
+
// the use and the closure.
167
169
ifawaitbooleanFlag{
168
-
// This is an actual use since a2 is a different actor from a1
169
-
await a2.useKlass(ns1)
170
+
await a2.useKlass(ns1) // expected-tns-note {{use here could race}}
170
171
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableKlass'}}
171
172
} else {
172
173
closure() // expected-tns-note {{use here could race}}
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
237
238
}
238
239
239
-
extensionActor{
240
+
extensionMyActor{
240
241
// Simple just capture self and access field.
241
242
func simpleClosureCaptureSelfAndTransfer()async{
242
243
letclosure:()->()={
@@ -428,7 +429,7 @@ extension Actor {
428
429
}
429
430
430
431
func testSimpleLetClosureCaptureActor()async{
431
-
leta=Actor()
432
+
leta=MyActor()
432
433
letclosure={print(a)}
433
434
awaittransferToMain(closure) // expected-complete-warning {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
434
435
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
awaittransferToMain(closure) // expected-complete-warning {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
await a.useKlass(x) // expected-tns-warning {{transferring 'x' may cause a data race}}
1578
1579
// expected-tns-note @-1 {{transferring disconnected 'x' to actor-isolated callee could cause races in between callee actor-isolated and local nonisolated uses}}
1579
1580
// expected-complete-warning @-2 {{passing argument of non-sendable type 'NonSendableKlass' into actor-isolated context may introduce data races}}
1580
1581
useValue(x) // expected-tns-note {{use here could race}}
await klass.asyncCallWithIsolatedParameter(isolation: other) // expected-tns-warning {{transferring 'self.klass' may cause a data race}}
1587
+
// expected-tns-note @-1 {{transferring 'self'-isolated 'self.klass' to actor-isolated callee could cause races between actor-isolated and 'self'-isolated uses}}
1588
+
// expected-complete-warning @-2 {{passing argument of non-sendable type 'NonSendableKlass' into actor-isolated context may introduce data races}}
await klass.asyncCallWithIsolatedParameter(isolation: other) // expected-tns-warning {{transferring 'self.klass' may cause a data race}}
1595
+
// expected-tns-note @-1 {{transferring 'self'-isolated 'self.klass' to actor-isolated callee could cause races between actor-isolated and 'self'-isolated uses}}
1596
+
// expected-complete-warning @-2 {{passing argument of non-sendable type 'NonSendableKlass' into actor-isolated context may introduce data races}}
await klass.directAsyncCallWithIsolatedParameter(isolation: other) // expected-tns-warning {{transferring 'self.klass' may cause a data race}}
1608
+
// expected-tns-note @-1 {{transferring 'self'-isolated 'self.klass' to actor-isolated callee could cause races between actor-isolated and 'self'-isolated uses}}
1609
+
// expected-complete-warning @-2 {{passing argument of non-sendable type 'NonSendableKlass' into actor-isolated context may introduce data races}}
await klass.directAsyncCallWithIsolatedParameter(isolation: other) // expected-tns-warning {{transferring 'self.klass' may cause a data race}}
1616
+
// expected-tns-note @-1 {{transferring 'self'-isolated 'self.klass' to actor-isolated callee could cause races between actor-isolated and 'self'-isolated uses}}
1617
+
// expected-complete-warning @-2 {{passing argument of non-sendable type 'NonSendableKlass' into actor-isolated context may introduce data races}}
0 commit comments