// RUN: %target-swift-emit-silgen -Xllvm -sil-print-types %s | %FileCheck %s // https://github.com/apple/swift/issues/63682 // Test that we adjust to abstraction differences when assigning in generated // key path accessors. struct Foo { var closure: () -> A? } // CHECK-LABEL: sil hidden [ossa] @{{.+}}physicalFunctionValue func physicalFunctionValue() { // CHECK: keypath $WritableKeyPath, () -> Optional>, (root $Foo; settable_property $() -> Optional, id ##Foo.closure, getter @$[[GETTER:[_a-zA-Z0-9]+]] {{.+}}, setter @$[[SETTER:[_a-zA-Z0-9]+]] let _ = \Foo.closure } // CHECK: // end sil function '{{.+}}physicalFunctionValue // CHECK: sil shared [thunk] [ossa] @$[[GETTER]] : $@convention(keypath_accessor_getter) (@in_guaranteed Foo) -> @out @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for > { // CHECK: bb0([[OUT_FN:%[0-9]+]] {{.+}}): // CHECK: [[SRC_REABSTR:%[0-9]+]] = convert_function %{{[0-9]+}} : $@callee_guaranteed () -> @out Optional to $@callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for > // CHECK-NEXT: store [[SRC_REABSTR]] to [init] [[OUT_FN]] : $*@callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for > // CHECK: } // end sil function '$[[GETTER]]' // CHECK: sil shared [thunk] [ossa] @$[[SETTER]] : $@convention(keypath_accessor_setter) (@in_guaranteed @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for >, @inout Foo) -> () { // CHECK: bb0({{.+}}, [[FOO:%[0-9]+]] : $*Foo): // CHECK: [[SRC_REABSTR:%[0-9]+]] = convert_function %{{[0-9]+}} : $@callee_guaranteed () -> @out Optional to $@callee_guaranteed @substituted <τ_0_0> () -> @out Optional<τ_0_0> for // CHECK-NEXT: [[DEST:%[0-9]+]] = struct_element_addr [[FOO]] : $*Foo, #Foo.closure // CHECK-NEXT: assign [[SRC_REABSTR]] to [[DEST]] : $*@callee_guaranteed @substituted <τ_0_0> () -> @out Optional<τ_0_0> for // CHECK: } // end sil function '$[[SETTER]]'