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
// expected-sns-warning@-1 {{call site passes `self` or a non-sendable argument of this function to another thread, potentially yielding a race with the caller}}
246
239
}
247
240
248
241
@available(SwiftStdlib 5.1,*)
@@ -261,15 +254,21 @@ final class NonSendable {
261
254
func call()async{
262
255
awaitupdate()
263
256
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
257
+
// expected-sns-warning@-2 {{call site passes `self` or a non-sendable argument of this function to another thread, potentially yielding a race with the caller}}
258
+
// expected-sns-warning@-3 {{passing argument of non-sendable type 'NonSendable' from nonisolated context to main actor-isolated context at this call site could yield a race with accesses later in this function (3 access sites displayed)}}
259
+
264
260
265
261
awaitself.update()
266
262
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
263
+
// expected-sns-note@-2 {{access here could race}}
267
264
268
265
_ =await x
269
266
// expected-warning@-1 {{non-sendable type 'NonSendable' passed in implicitly asynchronous call to main actor-isolated property 'x' cannot cross actor boundary}}
267
+
// expected-sns-note@-2 {{access here could race}}
270
268
271
269
_ =awaitself.x
272
270
// expected-warning@-1 {{non-sendable type 'NonSendable' passed in implicitly asynchronous call to main actor-isolated property 'x' cannot cross actor boundary}}
271
+
// expected-sns-note@-2 {{access here could race}}
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
283
+
// expected-sns-warning@-2 {{passing argument of non-sendable type 'NonSendable' from nonisolated context to main actor-isolated context at this call site could yield a race with accesses later in this function (1 access site displayed)}}
284
284
285
285
_ =await t.x
286
286
// expected-warning @-1 {{non-sendable type 'NonSendable' passed in implicitly asynchronous call to main actor-isolated property 'x' cannot cross actor boundary}}
287
+
// expected-sns-note@-2 {{access here could race}}
// FIXME: Both cases below should also produce a diagnostic with SendNonSendable,
300
-
// because the 'ns' parameter should be merged into the MainActor's region.
301
-
302
300
awaitg(ns)
303
301
// expected-targeted-and-complete-warning@-1 {{passing argument of non-sendable type 'NonSendable' outside of main actor-isolated context may introduce data races}}
302
+
// expected-sns-warning@-2 {{call site passes `self` or a non-sendable argument of this function to another thread, potentially yielding a race with the caller}}
303
+
// expected-sns-warning@-3 {{passing argument of non-sendable type 'NonSendable' from main actor-isolated context to nonisolated context at this call site could yield a race with accesses later in this function (1 access site displayed)}}
// expected-targeted-and-complete-warning@-1 {{passing argument of non-sendable type 'NonSendable' outside of main actor-isolated context may introduce data races}}
308
+
// expected-sns-note@-2 {{access here could race}}
0 commit comments