Xcode-beta (7A120f): Throwing functions returning scalars do not bridge to ObjC

Originator:owensd
Number:rdar://21360155 Date Originated:12-Jun-2015 10:25 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-beta (7A120f)
Classification:Enhancement Reproducible:Always
 
With the following Swift code:

public enum MyError: ErrorType {
    case Code(code: Int)
    case Message(code: Int, message: String)
}

@objc public class MyType : NSObject {
    public func throwException(type: Int) throws {
        if type == 0 {
            throw MyError.Code(code: type)
        }
        else {
            throw MyError.Message(code: type, message: "Hello!")
        }
    }
    
    public func throwExceptionInt() throws -> Int {
        throw MyError.Code(code: 0)
    }
    
    public func throwExceptionString() throws -> String {
        throw MyError.Code(code: 1)
    }
}

Only the “throwException” and “throwExceptionString” methods bridge to ObjC.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!