// RUN: %target-swift-frontend -emit-silgen -enable-sil-ownership %s | %FileCheck %s // When we synthesize an inherited designated initializer, the default // arguments are still conceptually rooted on the base declaration. // When we call such an initializer, we have to construct substitutions // in terms of the base class generic signature, rather than the // derived class generic signature. class Puppy { init(t: T? = nil, u: U? = nil) {} } class Chipmunk : Puppy {} class Kitten : Puppy {} class Goldfish { class Shark : Puppy {} } // CHECK-LABEL: sil hidden @_T027default_arguments_inherited4doItyyF : $@convention(thin) () -> () { func doIt() { // CHECK: [[ARG1:%.*]] = function_ref @_T027default_arguments_inherited5PuppyC1t1uACyxq_GxSg_q_SgtcfcfA_ // CHECK: apply [[ARG1]]({{.*}}) // CHECK: [[ARG2:%.*]] = function_ref @_T027default_arguments_inherited5PuppyC1t1uACyxq_GxSg_q_SgtcfcfA0_ // CHECK: apply [[ARG2]]({{.*}}) _ = Chipmunk() // CHECK: [[ARG1:%.*]] = function_ref @_T027default_arguments_inherited5PuppyC1t1uACyxq_GxSg_q_SgtcfcfA_ // CHECK: apply [[ARG1]](%{{.*}}) // CHECK: [[ARG2:%.*]] = function_ref @_T027default_arguments_inherited5PuppyC1t1uACyxq_GxSg_q_SgtcfcfA0_ // CHECK: apply [[ARG2]](%{{.*}}) _ = Kitten() // CHECK: [[ARG1:%.*]] = function_ref @_T027default_arguments_inherited5PuppyC1t1uACyxq_GxSg_q_SgtcfcfA_ // CHECK: apply [[ARG1]](%{{.*}}) // CHECK: [[ARG2:%.*]] = function_ref @_T027default_arguments_inherited5PuppyC1t1uACyxq_GxSg_q_SgtcfcfA0_ // CHECK: apply [[ARG2]](%{{.*}}) _ = Goldfish.Shark() }