mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
For some reason, doing it in the other order causes a crash. I suspect this is because we create new instructions below, but if there's no insertion point, the instruction is never added to a basic block.
18 lines
545 B
Swift
18 lines
545 B
Swift
// RUN: %target-swift-emit-sil %s -o /dev/null -verify
|
|
|
|
//===--- Function declaration with uninhabited parameter type
|
|
|
|
func foo(baz: Never) -> Int { // expected-note {{'baz' is uninhabited, so this function body can never be executed}}
|
|
print("I can't be called!") // expected-warning{{will never be executed}}
|
|
return 0
|
|
}
|
|
|
|
func bar(baz: Never) -> Int {} // ok
|
|
|
|
// We used to crash when emitting the closure below.
|
|
enum E {
|
|
static func f(_: E) {}
|
|
}
|
|
|
|
let _: (E.Type) -> (E) -> () = { s in { e in s.f(e) } }
|