[SR-9035] Bridging of Unmanaged CF types to ObjC doesn't work for throwing functions #51538
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
good first issue
Good for newcomers
Environment
Apple Swift version 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1)
Target: x86_64-apple-darwin17.7.0
Additional Detail from JIRA
md5: a75bc65432adfa13920e0584ecf94a27
Issue Description:
If you define the following protocol in Swift it causes an error:
Throwing method cannot be a member of an @objc protocol because it returns a value of type 'Unmanaged<CFArray>'; return 'Void' or a type that bridges to an Objective-C class
The error is wrong as Unmanaged<CFArray> does bridge to an Objective-C class.
eg. if you define the following in Swift
the following appears in Module-Swift.h (albeit albeit with a warning) and can be used
If you define a protocol in Objective-C which matches the signature of TestProtocol and view the file's generated interface it looks as you'd expect:
It is imported into Swift as
but the protocol can't be implemented because of the error:
Throwing method cannot be an implementation of an @objc requirement because it returns a value of type 'Unmanaged<CFArray>'; return 'Void' or a type that bridges to an Objective-C class
The text was updated successfully, but these errors were encountered: