Swift crash: NSStringFromClass in Self-returning extension

Originator:joachimb
Number:rdar://20578307 Date Originated:16-Apr-2015 03:22 PM
Status:Open Resolved:
Product:Xcode Product Version:Xcode 6.3 and Xcode 6.4 6E7 on Yosemite 10.10.3 14D131
Classification:Crash Reproducible:Always
 
Summary:
extension NSObject {
    class func hej() -> Self? {
        var s = NSStringFromClass(self as! AnyClass)
        return nil;
    }
}

https://gist.github.com/nevyn/d18c9e9e78a2fe75bdbb

Steps to Reproduce:
1. Write the code above (returning ref to Self?, in an extension, casting to AnyClass)


Expected Results:
2. It just works

Actual Results:
2. It crashes

Version:
Xcode 6.3 and Xcode 6.4 6E7 on Yosemite 10.10.3 14D131.

Notes:


Configuration:
Xcode 6.3 and Xcode 6.4 6E7 on Yosemite 10.10.3 14D131.

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!