Last active
September 15, 2016 22:46
-
-
Save chris-hatton/b2f068bd3cba8a86eb2f7a70bc72813f to your computer and use it in GitHub Desktop.
Test of fatalError() backed by @NoReturn (Swift2) vs. Never (Swift3)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This compiles in both Swift 2 and 3 | |
func test1() -> Int { | |
fatalError() | |
} | |
// This compiled in Swift2 but no longer does in Swift 3 | |
let test2 : () -> Int = { | |
fatalError() | |
} | |
// Compiles in Swift 3 | |
let test2 : () -> Int = { | |
if false { return 0 } | |
fatalError() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment