Open
Description
Description
NS_SWIFT_UI_ACTOR
is not properly recognized on Objective-C block typedefs. This should be possible according to #58150 and #70693, but as far as I can tell it's not working on Xcode 15.4 or the latest Xcode 16 toolchain. Interestingly enough, NS_SWIFT_SENDABLE
seems to be working as intended.
Reproduction
typedef void (^MainActorCompletionHandler)(void) NS_SWIFT_UI_ACTOR;
typedef void (^SendableCompletionHandler)(void) NS_SWIFT_SENDABLE;
Is translated as:
@MainActor public typealias MainActorCompletionHandler = () -> Void
public typealias SendableCompletionHandler = @Sendable () -> Void
Notice how the main actor closure has the @MainActor
applied before the typedef
, which is not valid and seems to be ignored by Swift. The sendable closure, instead, is correctly annotated.
Expected behavior
public typealias MainActorCompletionHandler = @MainActor () -> Void
Environment
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Additional information
For what is worth, I've tried placing the NS_SWIFT_UI_ACTOR
annotation on pretty much every position inside the typedef
without any success 😅
NS_SWIFT_UI_ACTOR typedef NS_SWIFT_UI_ACTOR void NS_SWIFT_UI_ACTOR (^ NS_SWIFT_UI_ACTOR MainActorCompletionHandler)(void) NS_SWIFT_UI_ACTOR;