Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Things that can crash Swift
//Crashes compiler
func toAny(x:AnyObject) -> Any {
return x as Any
}
//SegFaults when Run
reflect(Int)
reflect(Int.self)
reflect(String)
//... and friends
1 as Any
"" as Any
var i = 1
i as Any
var fn = {(x:AnyObject) in x as Any}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment