Swift 6 concurrency check not complaining about Objc block property #77416
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
I work on an ObjC framework which contains an
Option
class with abeforeSend
property block callback like so (names changed for simplicity):The
beforeSend
callback can be called from any thread, and when we do call it from a thread other than the one the user used to create the option object, the app crashes withEXC_BREAKPOINT
, if the user didn't mark the closure with@Sendable
.I would think that the compiler should complain about this in Swift 6 mode. Am I missing something?
Reproduction
This crashes in runtime when beforeSend is used in a background thread:
This does not crashes in runtime:
Expected behavior
I would expected the compiler to complain about the missing
@Sendable
in the closure or any other error.Environment
swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: arm64-apple-macosx15.0
Additional information
No response
The text was updated successfully, but these errors were encountered: