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.swift
+17-10Lines changed: 17 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -245,7 +245,7 @@ extension Actor {
245
245
awaittransferToMain(closure) // expected-complete-warning {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
246
246
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
247
247
// expected-tns-warning @-2 {{transferring 'closure' may cause a data race}}
248
-
// expected-tns-note @-3 {{transferring actor-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and actor-isolated uses}}
248
+
// expected-tns-note @-3 {{transferring 'self'-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and 'self'-isolated uses}}
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type '(Int, () -> ())' into main actor-isolated context may introduce data races}}
257
257
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
258
-
// expected-tns-warning @-2 {{actor-isolated value of type '(Int, () -> ())' transferred to main actor-isolated context}}
258
+
// expected-tns-warning @-2 {{'self'-isolated value of type '(Int, () -> ())' transferred to main actor-isolated context}}
awaittransferToMain(x) // expected-tns-warning {{actor-isolated value of type '(() -> (), Int)' transferred to main actor-isolated context}}
267
+
awaittransferToMain(x) // expected-tns-warning {{'self'-isolated value of type '(() -> (), Int)' transferred to main actor-isolated context}}
268
268
// expected-complete-warning @-1 {{passing argument of non-sendable type '(() -> (), Int)' into main actor-isolated context may introduce data races}}
269
269
// expected-complete-note @-2 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
270
270
}
@@ -276,7 +276,7 @@ extension Actor {
276
276
letx:Any?=(1, closure)
277
277
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type 'Any?' into main actor-isolated context may introduce data races}}
278
278
// expected-tns-warning @-1 {{transferring 'x' may cause a data race}}
279
-
// expected-tns-note @-2 {{transferring actor-isolated 'x' to main actor-isolated callee could cause races between main actor-isolated and actor-isolated uses}}
279
+
// expected-tns-note @-2 {{transferring 'self'-isolated 'x' to main actor-isolated callee could cause races between main actor-isolated and 'self'-isolated uses}}
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type 'Any?' into main actor-isolated context may introduce data races}}
291
291
// expected-tns-warning @-1 {{transferring 'x' may cause a data race}}
292
-
// expected-tns-note @-2 {{transferring actor-isolated 'x' to main actor-isolated callee could cause races between main actor-isolated and actor-isolated uses}}
292
+
// expected-tns-note @-2 {{transferring 'self'-isolated 'x' to main actor-isolated callee could cause races between main actor-isolated and 'self'-isolated uses}}
293
293
}
294
294
295
295
func simpleClosureCaptureSelfWithReinit()async{
@@ -301,7 +301,7 @@ extension Actor {
301
301
awaittransferToMain(closure) // expected-complete-warning {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
302
302
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
303
303
// expected-tns-warning @-2 {{transferring 'closure' may cause a data race}}
304
-
// expected-tns-note @-3 {{transferring actor-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and actor-isolated uses}}
304
+
// expected-tns-note @-3 {{transferring 'self'-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and 'self'-isolated uses}}
305
305
306
306
closure ={}
307
307
@@ -327,7 +327,7 @@ extension Actor {
327
327
awaittransferToMain(closure) // expected-complete-warning {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
328
328
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
329
329
// expected-tns-warning @-2 {{transferring 'closure' may cause a data race}}
330
-
// expected-tns-note @-3 {{transferring actor-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and actor-isolated uses}}
330
+
// expected-tns-note @-3 {{transferring 'self'-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and 'self'-isolated uses}}
331
331
}
332
332
333
333
func simpleClosureCaptureSelfWithReinit3()async{
@@ -349,7 +349,7 @@ extension Actor {
349
349
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
350
350
// expected-tns-note @-2 {{use here could race}}
351
351
// expected-tns-warning @-3 {{transferring 'closure' may cause a data race}}
352
-
// expected-tns-note @-4 {{transferring actor-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and actor-isolated uses}}
352
+
// expected-tns-note @-4 {{transferring 'self'-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and 'self'-isolated uses}}
353
353
}
354
354
355
355
// In this case, we reinit along both paths, but only one has an actor derived
@@ -372,7 +372,7 @@ extension Actor {
372
372
awaittransferToMain(closure) // expected-complete-warning {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
373
373
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
374
374
// expected-tns-warning @-2 {{transferring 'closure' may cause a data race}}
375
-
// expected-tns-note @-3 {{transferring actor-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and actor-isolated uses}}
375
+
// expected-tns-note @-3 {{transferring 'self'-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and 'self'-isolated uses}}
376
376
}
377
377
378
378
#if TYPECHECKER_ONLY
@@ -539,7 +539,7 @@ extension Actor {
539
539
awaittransferToMain(closure) // expected-complete-warning {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
540
540
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
541
541
// expected-tns-warning @-2 {{transferring 'closure' may cause a data race}}
542
-
// expected-tns-note @-3 {{transferring actor-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and actor-isolated uses}}
542
+
// expected-tns-note @-3 {{transferring 'self'-isolated 'closure' to main actor-isolated callee could cause races between main actor-isolated and 'self'-isolated uses}}
Copy file name to clipboardExpand all lines: test/Concurrency/transfernonsendable_region_based_sendability.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -442,7 +442,7 @@ actor A_Sendable {
442
442
// support the ability to dynamically invoke the synchronous closure on
443
443
// the specific actor.
444
444
await a.foo(captures_self) // expected-tns-warning {{transferring 'captures_self' may cause a data race}}
445
-
// expected-tns-note @-1 {{transferring actor-isolated 'captures_self' to actor-isolated callee could cause races between actor-isolated and actor-isolated uses}}
445
+
// expected-tns-note @-1 {{transferring 'self'-isolated 'captures_self' to actor-isolated callee could cause races between actor-isolated and 'self'-isolated uses}}
446
446
// expected-complete-warning @-2 {{passing argument of non-sendable type '() -> ()' into actor-isolated context may introduce data races}}
447
447
// expected-complete-note @-3 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
0 commit comments