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
func concurrentClosures<T>(_:T){ // expected-note{{consider making generic parameter 'T' conform to the 'Sendable' protocol}} {{26-26=: Sendable}}
308
+
func concurrentClosures<T:SendableMetatype>(_:T){ // expected-note{{consider making generic parameter 'T' conform to the 'Sendable' protocol}} {{44-44= & Sendable}}
309
309
acceptConcurrentUnary{(x:T)in
310
310
_ = x // ok
311
311
acceptConcurrentUnary{ _ in x } // expected-warning{{capture of 'x' with non-sendable type 'T' in a '@Sendable' closure}}
// expected-complete-note@-1{{add '@preconcurrency' to the 'NotIsolated' conformance to suppress isolation-related diagnostics}}{{36-36=@preconcurrency }}
235
235
// expected-complete-tns-note@-2{{turn data races into runtime errors with '@preconcurrency'}}{{36-36=@preconcurrency }}
236
236
// expected-complete-tns-note@-3{{mark all declarations used in the conformance 'nonisolated'}}
237
+
// expected-complete-tns-note@-4{{isolate this conformance to the main actor with '@MainActor'}}
// expected-tns-warning @-1 {{sending 'ns' risks causing data races}}
310
-
// expected-tns-note @-2 {{sending 'ns' to main actor-isolated global function 'transferToMainIndirect' risks causing data races between main actor-isolated and local nonisolated uses}}
310
+
// expected-tns-note @-2 {{sending task-isolated 'ns' to main actor-isolated global function 'transferToMainIndirect' risks causing data races between main actor-isolated and task-isolated uses}}
311
311
// expected-complete-warning @-3 {{passing argument of non-sendable type 'T' into main actor-isolated context may introduce data races}}
312
-
print(ns) // expected-tns-note {{access can happen concurrently}}
312
+
print(ns)
313
313
314
314
awaittransferToMainIndirect(ns2)
315
315
print(ns2)
316
316
317
317
awaittransferToMainIndirect(ns3)
318
318
// expected-tns-warning @-1 {{sending 'ns3' risks causing data races}}
319
-
// expected-tns-note @-2 {{sending 'ns3' to main actor-isolated global function 'transferToMainIndirect' risks causing data races between main actor-isolated and local nonisolated uses}}
319
+
// expected-tns-note @-2 {{sending task-isolated 'ns3' to main actor-isolated global function 'transferToMainIndirect' risks causing data races between main actor-isolated and task-isolated uses}}
320
320
// expected-complete-warning @-3 {{passing argument of non-sendable type 'T' into main actor-isolated context may introduce data races}}
321
-
print(ns3) // expected-tns-note {{access can happen concurrently}}
321
+
print(ns3)
322
322
323
323
awaittransferToMainIndirect(ns4)
324
324
// expected-tns-warning @-1 {{sending 'ns4' risks causing data races}}
325
-
// expected-tns-note @-2 {{sending 'ns4' to main actor-isolated global function 'transferToMainIndirect' risks causing data races between main actor-isolated and local nonisolated uses}}
325
+
// expected-tns-note @-2 {{sending task-isolated 'ns4' to main actor-isolated global function 'transferToMainIndirect' risks causing data races between main actor-isolated and task-isolated uses}}
326
326
// expected-complete-warning @-3 {{passing argument of non-sendable type 'T' into main actor-isolated context may introduce data races}}
327
-
print(ns4) // expected-tns-note {{access can happen concurrently}}
0 commit comments