// RUN: %target-swift-emit-silgen -Xllvm -sil-print-types %s | %FileCheck %s // rdar://problem/67419937 class Class { var fn: ((T) -> ())? = nil init(_: T) where T == Int {} } // CHECK-LABEL: sil hidden [ossa] @$s34stored_property_init_reabstraction5ClassCyACySiGSicSiRszlufc : $@convention(method) (Int, @owned Class) -> @owned Class { // CHECK: [[SELF:%.*]] = mark_uninitialized [rootself] %1 : $Class // CHECK: [[BORROW:%.*]] = begin_borrow [[SELF]] : $Class // CHECK: [[ADDR:%.*]] = ref_element_addr [[BORROW]] : $Class, #Class.fn // CHECK: [[INIT:%.*]] = function_ref @$s34stored_property_init_reabstraction5ClassC2fnyxcSgvpfi : $@convention(thin) <τ_0_0> () -> @owned Optional<@callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0>> // CHECK: [[VALUE:%.*]] = apply [[INIT]]() : $@convention(thin) <τ_0_0> () -> @owned Optional<@callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0>> // CHECK: store [[VALUE]] to [init] [[ADDR]] : $*Optional<@callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for > // CHECK: end_borrow [[BORROW]] : $Class struct Struct { var fn: ((T) -> ())? = nil init(_: T) where T == Int {} } // CHECK-LABEL: sil hidden [ossa] @$s34stored_property_init_reabstraction6StructVyACySiGSicSiRszlufC : $@convention(method) (Int, @thin Struct.Type) -> @owned Struct { // CHECK: [[SELF_BOX:%.*]] = mark_uninitialized [rootself] {{%.*}} : ${ var Struct } // CHECK: [[SELF_LIFETIME:%[^,]+]] = begin_borrow [lexical] [var_decl] [[SELF_BOX]] // CHECK: [[SELF:%.*]] = project_box [[SELF_LIFETIME]] : ${ var Struct }, 0 // CHECK: [[ADDR:%.*]] = struct_element_addr [[SELF]] : $*Struct, #Struct.fn // CHECK: [[INIT:%.*]] = function_ref @$s34stored_property_init_reabstraction6StructV2fnyxcSgvpfi : $@convention(thin) <τ_0_0> () -> @owned Optional<@callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0>> // CHECK: [[VALUE:%.*]] = apply [[INIT]]() : $@convention(thin) <τ_0_0> () -> @owned Optional<@callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for <τ_0_0>> // CHECK: store [[VALUE]] to [init] [[ADDR]] : $*Optional<@callee_guaranteed @substituted <τ_0_0> (@in_guaranteed τ_0_0) -> () for > struct ComplexExample { var (fn, value): (((T) -> ())?, U?) = (nil, nil) var anotherValue: (((T) -> ())?, U?) = (nil, nil) init(_: T) where T == String {} }