Files
swift-mirror/test/decl/ext/objc_implementation_async_availability.swift
Xi Ge aeb43916cd [ClangImporter] Don't let imported OS availability suppress a method's async alternative clue. rdar://175355488
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.
2026-07-06 16:15:48 -07:00

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 []
}
}