-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
I cannot see a scenario where these conversions could actually introduce races. My guess would have been that you could never form these functions in an unsafe way in the first place. Maybe I don't see it, but I thought it was at least worth a bug report.
Could it be that the @Sendable-ness is not being taken into account?
Reproduction
class NonSendable {}
let a: @Sendable (NonSendable) -> Void = { _ in }
// warning: Cannot convert '@Sendable (NonSendable) -> Void' to '@Sendable (NonSendable) async -> Void' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol
let b: @Sendable (NonSendable) async -> Void = a
let c: @Sendable () -> NonSendable = { fatalError() }
// warning: Cannot convert '@Sendable () -> NonSendable' to '@Sendable () async -> NonSendable' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol
let d: @Sendable () async -> NonSendable = cExpected behavior
I think both of these should build warning-free.
Environment
Apple Swift version 6.3-dev (LLVM f6e8f31819e2e67, Swift cecebdd)
Additional information
No response
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels