Files
swift-mirror/test/SILGen/if_guard_addressable.swift
Joe Groff dc043cf05d SILGen: Track original variable's cleanup state for addressable buffer cleanups.
Don't try to delete the value on paths where the value hasn't yet been deleted.
2025-08-13 16:51:12 -07:00

20 lines
367 B
Swift

// RUN: %target-swift-emit-silgen -enable-experimental-feature AddressableParameters %s
// REQUIRES: swift_feature_AddressableParameters
struct Foo {}
func foo(_: borrowing @_addressable Foo) {}
func bar() -> (Foo, Int)? { return nil }
func test1() {
guard let (f, i) = bar() else {return}
foo(f)
}
func test2() {
if let (f, i) = bar() {foo(f)} else {}
}