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-12Lines changed: 8 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -413,24 +413,20 @@ extension NotConcurrent {
413
413
func f(){}
414
414
415
415
func test(){
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}}
418
-
f()
416
+
Task{ // expected-tns-warning {{passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure}}
417
+
f() // expected-tns-note {{closure captures 'self' which is accessible to code in the current task}}
419
418
}
420
419
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}}
423
-
self.f()
420
+
Task{ // expected-tns-warning {{passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure}}
421
+
self.f() // expected-tns-note {{closure captures 'self' which is accessible to code in the current task}}
424
422
}
425
423
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}}
428
-
f()
424
+
Task{[self]in // expected-tns-warning {{passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure}}
425
+
f() // expected-tns-note {{closure captures 'self' which is accessible to code in the current task}}
429
426
}
430
427
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}}
433
-
self.f()
428
+
Task{[self]in // expected-tns-warning {{passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure}}
429
+
self.f() // expected-tns-note {{closure captures 'self' which is accessible to code in the current task}}
// 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 {{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}}
504
+
Task{[a]in // expected-tns-warning {{passing closure as a 'sending' parameter risks causing data races between 'a'-isolated code and concurrent execution of the closure}}
0 commit comments