Files
swift-mirror/test/SILGen/local_decl_after_unreachable.swift
Erik Eckstein 2200632a95 SILGen: ignore unreachable var decls
Fixes a crash in case a lazy var is declared after a return statement

https://github.com/apple/swift/issues/73736
2024-06-10 16:19:47 +02:00

19 lines
422 B
Swift

// RUN: %target-swift-emit-silgen %s | %FileCheck %s
// CHECK-LABEL: sil {{.*}} @${{.*}}3foo{{.*}}F : {{.*}} {
func foo() {
return bar(Baz())
struct Baz {
// CHECK-LABEL: sil {{.*}} @{{.*}}3foo{{.*}}3Baz{{.*}}C : {{.*}} {
init() {}
}
// CHECK-LABEL: sil {{.*}} @{{.*}}3foo{{.*}}3bar{{.*}}F : {{.*}} {
func bar(_: Any) {}
// Check that we don't crash here
lazy var v = 42
}