Swift compiler crashes due to existential downcast

Originator:m.purland
Number:rdar://17633009 Date Originated:7/10/2014
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification: Reproducible:Always
 
Crashing due to switch case let with downcast "as":

class SwiftCaseLetCrash {
    func doesNotWork() {
        let n: NSData? = "Test".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
        switch (n) {
        case let d as NSData:
            println("Test data: \(d)")
        default:
            println("No data")
        }
    }
}

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!