enum with generic type causes compiler to abort

Originator:jpcivile
Number:rdar://18756378 Date Originated:23-Oct-2014
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification: Reproducible:
 
Summary:
Trying to compile the following code, aborts the compiler:

enum APIResult<T : AnyObject> {
    case UnknownError(NSError?)
    case NetworkError
    case Value(T)
}

class APIObject {
    
}

func thisBreaksCompilation(res : APIResult<APIObject>) {
    
    switch (res) {
    case .NetworkError:
        println("Net Error")
    case .UnknownError(let err):
        println("Other error")
    case .Value(let val):
        println("Value!")
    }
    
}

Aborts the compiler with errors or warnings on those lines.

Steps to Reproduce:
Paste the code into a swift file and compile

Expected Results:
Successful compilation

Actual Results:
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

Version:
XCode 6.1 (6A1052d)
OS X 10.9.5 (13F34)

Notes:
The following code, however, does compile:

enum APIResult<T : AnyObject> {
    case UnknownError(NSError?)
    case NetworkError
    case Value(T)
}

class APIObject {
    
}

func thisBreaksCompilation<T>(res : APIResult<T>) {
    
    switch (res) {
    case .NetworkError:
        println("Net Error")
    case .UnknownError(let err):
        println("Other error")
    case .Value(let val):
        println("Value!")
    }
    
}

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!