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/concurrent_value_checking.swift
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -413,19 +413,23 @@ extension NotConcurrent {
413
413
func f(){}
414
414
415
415
func test(){
416
-
Task{ // expected-tns-warning {{task-isolated value of type '() async -> ()' passed as a strongly transferred parameter}}
416
+
Task{ // expected-tns-warning {{sending value of non-Sendable type '() async -> ()' risks causing data races}}
417
+
// expected-tns-note @-1 {{Passing task-isolated value of non-Sendable type '() async -> ()' as a 'sending' parameter risks causing races inbetween task-isolated uses and uses reachable from the callee}}
417
418
f()
418
419
}
419
420
420
-
Task{ // expected-tns-warning {{task-isolated value of type '() async -> ()' passed as a strongly transferred parameter}}
421
+
Task{ // expected-tns-warning {{sending value of non-Sendable type '() async -> ()' risks causing data races}}
422
+
// expected-tns-note @-1 {{Passing task-isolated value of non-Sendable type '() async -> ()' as a 'sending' parameter risks causing races inbetween task-isolated uses and uses reachable from the callee}}
421
423
self.f()
422
424
}
423
425
424
-
Task{[self]in // expected-tns-warning {{task-isolated value of type '() async -> ()' passed as a strongly transferred parameter}}
426
+
Task{[self]in // expected-tns-warning {{sending value of non-Sendable type '() async -> ()' risks causing data races}}
427
+
// expected-tns-note @-1 {{Passing task-isolated value of non-Sendable type '() async -> ()' as a 'sending' parameter risks causing races inbetween task-isolated uses and uses reachable from the callee}}
425
428
f()
426
429
}
427
430
428
-
Task{[self]in // expected-tns-warning {{task-isolated value of type '() async -> ()' passed as a strongly transferred parameter}}
431
+
Task{[self]in // expected-tns-warning {{sending value of non-Sendable type '() async -> ()' risks causing data races}}
432
+
// expected-tns-note @-1 {{Passing task-isolated value of non-Sendable type '() async -> ()' as a 'sending' parameter risks causing races inbetween task-isolated uses and uses reachable from the callee}}
// FIXME: The `a` in the capture list and `isolated a` are the same,
503
503
// but the actor isolation checker doesn't know that.
504
-
Task{[a]in // expected-tns-warning {{'a'-isolated value of type '() async -> ()' passed as a strongly transferred parameter}}
504
+
Task{[a]in // expected-tns-warning {{sending value of non-Sendable type '() async -> ()' risks causing data races}}
505
+
// expected-tns-note @-1 {{Passing 'a'-isolated value of non-Sendable type '() async -> ()' as a 'sending' parameter risks causing races inbetween 'a'-isolated uses and uses reachable from the callee}}
// This is task isolated since we are capturing function arguments.
35
-
Task{ // expected-tns-warning {{task-isolated value of type '() async -> ()' passed as a strongly transferred parameter}}
35
+
Task{ // expected-tns-warning {{sending value of non-Sendable type '() async -> ()' risks causing data races}}
36
+
// expected-tns-note @-1 {{Passing task-isolated value of non-Sendable type '() async -> ()' as a 'sending' parameter risks causing races inbetween task-isolated uses and uses reachable from the callee}}
36
37
print(ns)
37
38
print(mt) // no warning: MyType is Sendable because we suppressed NonStrictClass's warning
Task{ // expected-tns-warning {{task-isolated value of type '() async -> ()' passed as a strongly transferred parameter; later accesses could race}}
29
+
Task{ // expected-tns-warning {{sending value of non-Sendable type '() async -> ()' risks causing data races; this is an error in the Swift 6 language mode}}
30
+
// expected-tns-note @-1 {{Passing task-isolated value of non-Sendable type '() async -> ()' as a 'sending' parameter risks causing races inbetween task-isolated uses and uses reachable from the callee}}
30
31
print(ns)
31
32
print(mt) // no warning by default: MyType is Sendable because we suppressed NonStrictClass's warning
Task{ // expected-tns-warning {{task-isolated value of type '() async -> ()' passed as a strongly transferred parameter}}
32
+
Task{ // expected-tns-warning {{sending value of non-Sendable type '() async -> ()' risks causing data races}}
33
+
// expected-tns-note @-1 {{Passing task-isolated value of non-Sendable type '() async -> ()' as a 'sending' parameter risks causing races inbetween task-isolated uses and uses reachable from the callee}}
33
34
print(ns)
34
35
print(mt) // no warning with targeted: MyType is Sendable because we suppressed NonStrictClass's warning
Copy file name to clipboardExpand all lines: test/Concurrency/transfernonsendable.swift
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -265,7 +265,8 @@ extension MyActor {
265
265
letx=(1, closure)
266
266
awaittransferToMain(x) // expected-complete-warning {{passing argument of non-sendable type '(Int, () -> ())' into main actor-isolated context may introduce data races}}
267
267
// expected-complete-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
268
-
// expected-tns-warning @-2 {{sending 'self'-isolated value of type '(Int, () -> ())' with later accesses to main actor-isolated context risks causing data races}}
268
+
// expected-tns-warning @-2 {{sending value of non-Sendable type '(Int, () -> ())' risks causing data races}}
269
+
// expected-tns-note @-3 {{sending 'self'-isolated value of non-Sendable type '(Int, () -> ())' to main actor-isolated global function 'transferToMain' risks causing races in between 'self'-isolated and main actor-isolated uses}}
awaittransferToMain(x) // expected-tns-warning {{sending 'self'-isolated value of type '(() -> (), Int)' with later accesses to main actor-isolated context risks causing data races}}
278
-
// expected-complete-warning @-1 {{passing argument of non-sendable type '(() -> (), Int)' into main actor-isolated context may introduce data races}}
279
-
// expected-complete-note @-2 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
278
+
awaittransferToMain(x) // expected-tns-warning {{sending value of non-Sendable type '(() -> (), Int)' risks causing data races}}
279
+
// expected-tns-note @-1 {{sending 'self'-isolated value of non-Sendable type '(() -> (), Int)' to main actor-isolated global function 'transferToMain' risks causing races in between 'self'-isolated and main actor-isolated uses}}
0 commit comments