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
[Concurrency] Don't check parameter and result types of function references for
Sendability.
Sendability of function references depends only on captures, and applies when the
function itself is passed across isolation boundaries. Parameter and result
values can only cross isolation boundaries when the function is called.
// expected-warning @-1 {{non-sendable type 'NonSendable' passed in implicitly asynchronous call to main actor-isolated property 'x' cannot cross actor boundary}}
286
286
}
287
287
288
+
@available(SwiftStdlib 5.1,*)
289
+
@Sendable
290
+
func globalSendable(_ ns:NonSendable)async{}
291
+
288
292
@available(SwiftStdlib 5.1,*)
289
293
@MainActor
290
294
func callNonisolatedAsyncClosure(
291
295
ns:NonSendable,
292
296
g:(NonSendable)async->Void
293
297
)async{
294
-
// FIXME: This should also produce a diagnostic with SendNonSendable, because
295
-
// the 'ns' parameter should be merged into the MainActor's region.
298
+
// FIXME: Both cases below should also produce a diagnostic with SendNonSendable,
299
+
// because the 'ns' parameter should be merged into the MainActor's region.
300
+
296
301
awaitg(ns)
297
302
// expected-targeted-and-complete-warning@-1 {{passing argument of non-sendable type 'NonSendable' outside of main actor-isolated context may introduce data races}}
// expected-targeted-and-complete-warning@-1 {{passing argument of non-sendable type 'NonSendable' outside of main actor-isolated context may introduce data races}}
0 commit comments