swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.58k stars 10.35k forks source link

Not all concurrency annotations added to Objective-C are visible in the Swift translation #74629

Open mattmassicotte opened 4 months ago

mattmassicotte commented 4 months ago

Motivation

I've discovered that if I add concurrency-related annotations to Objective-C signatures, the compiler understands them, but Xcode does not make them visible. Here's an example:

+ (void)jetPackConfiguration:(void (NS_SWIFT_SENDABLE ^)(void))completionHandler NS_SWIFT_DISABLE_ASYNC;

Note the lack of @Sendable

class func jetPackConfiguration(_ completionHandler: @escaping () -> Void)

Now it is entirely possible this is not a compiler issue. I'm just guessing because of this:

https://github.com/swiftlang/swift/pull/72037

Proposed solution

I'd like to see the fully annotated function siguature!

Alternatives considered

No response

Additional information

No response

MaxDesiatov commented 4 months ago

Is this reproducible for you with VS Code? If it's Xcode only, it might require filing an FB I'm afraid.

mattmassicotte commented 4 months ago

Yeah, it could be this is an Xcode issue. But, reason I assumed that may not be the case is because it took a compiler change to expose global actors in this same place.

hamishknight commented 3 months ago

Just to clarify, where are you viewing this information? Looks like @Sendable is printed in the generated interface, but it is not printed in quick help. In any case, this information should be coming from SourceKit, so it's fine for the bug to be here.

mattmassicotte commented 1 month ago

Sorry, I missed this question! Yes, I'm not seeing these details in Xcode's Quick Help popover window.

I've been experimenting with a bunch of other annotations as well. It seems like NS_SWIFT_UI_ACTOR definitely does end up working in this case, but many others do not.