Skip to content

Instantly share code, notes, and snippets.

@chris-hatton
Last active September 15, 2016 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-hatton/b2f068bd3cba8a86eb2f7a70bc72813f to your computer and use it in GitHub Desktop.
Save chris-hatton/b2f068bd3cba8a86eb2f7a70bc72813f to your computer and use it in GitHub Desktop.
Test of fatalError() backed by @NoReturn (Swift2) vs. Never (Swift3)
// 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