| // RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all %s -generic-specializer -module-name inherit | %FileCheck %s |
| |
| import Builtin |
| import Swift |
| |
| class MMFont { |
| } |
| |
| struct MMStorage<Key : Hashable, Value> { |
| } |
| |
| func ==(lhs: MMObject, rhs: MMObject) -> Bool |
| |
| class MMObject : Hashable { |
| var hashValue: Int { get } |
| } |
| |
| class MMString : MMObject { |
| } |
| |
| // CHECK-LABEL: @caller : $@convention(thin) (Int, Int) -> @owned MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>> { |
| sil @caller : $@convention(thin) (Int, Int) -> @owned MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>> { |
| bb0(%0 : $Int, %1 : $Int): |
| %3 = metatype $@thin MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>>.Type |
| %13 = function_ref @ext_fn1 : $@convention(thin) (Int, @thin MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>>.Type) -> @owned MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>> |
| %14 = apply %13(%0, %3) : $@convention(thin) (Int, @thin MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>>.Type) -> @owned MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>> |
| |
| // CHECK: [[STACK:%[0-9]+]] = alloc_stack $MMString |
| %37 = alloc_stack $MMString |
| // CHECK: [[ID:%[0-9]+]] = function_ref @_T06callee7inherit8MMStringC_SQyAB6MMFontCGTg5 : $@convention(method) (@owned MMString, Int, @owned MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>>) -> Bool |
| %34 = function_ref @callee : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@in τ_0_0, Int, @owned MMStorage<τ_0_0, τ_0_1>) -> Bool |
| // CHECK: [[LOAD:%[0-9]+]] = load [[STACK]] |
| // CHECK: apply [[ID]]([[LOAD]], %1, %{{[0-9]+}}) : $@convention(method) (@owned MMString, Int, @owned MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>>) -> Bool |
| %45 = apply %34<MMString, MMFont!>(%37, %1, %14) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@in τ_0_0, Int, @owned MMStorage<τ_0_0, τ_0_1>) -> Bool |
| dealloc_stack %37 : $*MMString |
| |
| return %14 : $MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>> |
| } |
| |
| // CHECK-LABEL: @_T06callee7inherit8MMStringC_SQyAB6MMFontCGTg5 : $@convention(method) (@owned MMString, Int, @owned MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>>) -> Bool { |
| // CHECK: [[META:%[0-9]+]] = metatype $@thick MMString.Type |
| // CHECK: [[ID3:%[0-9]+]] = witness_method $MMString, #Equatable."=="!1 : |
| // CHECK: [[STACK2:%[0-9]+]] = alloc_stack $MMString |
| // CHECK: [[STACK3:%[0-9]+]] = alloc_stack $MMString |
| // CHECK: apply [[ID3]]<MMString>([[STACK2]], [[STACK3]], [[META]]) : $@convention(witness_method) <τ_0_0 where τ_0_0 : Equatable> (@in τ_0_0, @in τ_0_0, @thick τ_0_0.Type) -> Bool |
| |
| // CHECK-LABEL: @callee : $@convention(method) <Key, Value where Key : Hashable> (@in Key, Int, @owned MMStorage<Key, Value>) -> Bool { |
| sil [noinline] @callee : $@convention(method) <Key, Value where Key : Hashable> (@in Key, Int, @owned MMStorage<Key, Value>) -> Bool { |
| bb0(%0 : $*Key, %1 : $Int, %2 : $MMStorage<Key, Value>): |
| %25 = metatype $@thick Key.Type |
| // CHECK: [[ID2:%[0-9]+]] = witness_method $Key, #Equatable."=="!1 : |
| %26 = witness_method $Key, #Equatable."=="!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : Equatable> (@in τ_0_0, @in τ_0_0, @thick τ_0_0.Type) -> Bool |
| %27 = alloc_stack $Key |
| %33 = alloc_stack $Key |
| // CHECK: apply [[ID2]]<Key> |
| %35 = apply %26<Key>(%27, %33, %25) : $@convention(witness_method) <τ_0_0 where τ_0_0 : Equatable> (@in τ_0_0, @in τ_0_0, @thick τ_0_0.Type) -> Bool |
| dealloc_stack %33 : $*Key |
| dealloc_stack %27 : $*Key |
| return %35 : $Bool |
| } |
| |
| sil @ext_fn1 : $@convention(thin) (Int, @thin MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>>.Type) -> @owned MMStorage<MMString, ImplicitlyUnwrappedOptional<MMFont>> |