mirror of
https://github.com/apple/swift.git
synced 2026-10-24 20:15:56 +02:00
A completion-handler method carrying an availability attribute was skipped when wiring the rename attribute that points to its async alternative, so an async @objc @implementation member could not match its completion-handler requirement and no ObjC thunk was generated as a result. This narrows the guard to methods that already carry a rename, checking their availability attributes syntactically. Resolving the async alternative here would trigger name lookup and re-enter member loading while the nominal is still importing, corrupting its member lookup table.
17 lines
854 B
Swift
17 lines
854 B
Swift
// RUN: %target-typecheck-verify-swift -verify-ignore-unrelated -import-objc-header %S/Inputs/objc_implementation_async_availability.h -enable-experimental-feature ObjCImplementation -target %target-stable-abi-triple -Xcc -Wno-nullability-completeness
|
|
// REQUIRES: objc_interop
|
|
// REQUIRES: swift_feature_ObjCImplementation
|
|
|
|
// An imported Objective-C completion-handler method that carries an
|
|
// availability attribute must still expose its async alternative. Otherwise an
|
|
// async member of an '@objc @implementation' extension fails to match the
|
|
// completion-handler requirement, no ObjC thunk is generated, and calling the
|
|
// method through the ObjC runtime crashes with "unrecognized selector".
|
|
|
|
@objc @implementation extension WidgetStore {
|
|
@available(SwiftStdlib 5.1, *)
|
|
public func fetchWidgets() async -> [any Widget] {
|
|
return []
|
|
}
|
|
}
|