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_region_based_sendability.swift
+10-3Lines changed: 10 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,10 @@ func test_closure_capture(a : A) async {
102
102
print(ns3)
103
103
104
104
// this should consume ns0
105
-
await a.run_closure(captures0) // expected-tns-warning {{sending value of non-Sendable type '() -> ()' with later accesses from nonisolated context to actor-isolated context risks causing data races}}
105
+
await a.run_closure(captures0)
106
+
// expected-tns-warning @-1 {{sending 'captures0' risks causing data races}}
107
+
// expected-tns-note @-2 {{sending 'captures0' to actor-isolated instance method 'run_closure' risks causing data races between actor-isolated and local nonisolated uses}}
108
+
106
109
// expected-complete-warning @-1 {{passing argument of non-sendable type '() -> ()' into actor-isolated context may introduce data races}}
107
110
// expected-complete-note @-2 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
108
111
@@ -112,7 +115,9 @@ func test_closure_capture(a : A) async {
112
115
print(ns3)
113
116
114
117
// this should consume ns1 and ns2
115
-
await a.run_closure(captures12) // expected-tns-warning {{sending value of non-Sendable type '() -> ()' with later accesses from nonisolated context to actor-isolated context risks causing data races}}
118
+
await a.run_closure(captures12)
119
+
// expected-tns-warning @-1 {{sending 'captures12' risks causing data races}}
120
+
// expected-tns-note @-2 {{sending 'captures12' to actor-isolated instance method 'run_closure' risks causing data races between actor-isolated and local nonisolated uses}}
116
121
// expected-complete-warning @-1 {{passing argument of non-sendable type '() -> ()' into actor-isolated context may introduce data races}}
117
122
// expected-complete-note @-2 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
118
123
@@ -123,7 +128,9 @@ func test_closure_capture(a : A) async {
123
128
print(ns3)
124
129
125
130
// this should consume ns3
126
-
await a.run_closure(captures3indirect) // expected-tns-warning {{sending value of non-Sendable type '() -> ()' with later accesses from nonisolated context to actor-isolated context risks causing data races}}
131
+
await a.run_closure(captures3indirect)
132
+
// expected-tns-warning @-1 {{sending 'captures3indirect' risks causing data races}}
133
+
// expected-tns-note @-2 {{sending 'captures3indirect' to actor-isolated instance method 'run_closure' risks causing data races between actor-isolated and local nonisolated uses}}
127
134
// expected-complete-warning @-1 {{passing argument of non-sendable type '() -> ()' into actor-isolated context may introduce data races}}
128
135
// expected-complete-note @-2 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
0 commit comments