blob: 26ceaecf96ef5a1baf2c847c68dc5b19ba909d44 [file] [log] [blame]
// RUN: %target-sil-opt -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 {
func hash(into hasher: inout Hasher)
}
class MMString : MMObject {
}
// CHECK-LABEL: @caller : $@convention(thin) (Int, Int) -> @owned MMStorage<MMString, Optional<MMFont>> {
sil @caller : $@convention(thin) (Int, Int) -> @owned MMStorage<MMString, Optional<MMFont>> {
bb0(%0 : $Int, %1 : $Int):
%3 = metatype $@thin MMStorage<MMString, Optional<MMFont>>.Type
%13 = function_ref @ext_fn1 : $@convention(thin) (Int, @thin MMStorage<MMString, Optional<MMFont>>.Type) -> @owned MMStorage<MMString, Optional<MMFont>>
%14 = apply %13(%0, %3) : $@convention(thin) (Int, @thin MMStorage<MMString, Optional<MMFont>>.Type) -> @owned MMStorage<MMString, Optional<MMFont>>
// CHECK: [[STACK:%[0-9]+]] = alloc_stack $MMString
%37 = alloc_stack $MMString
// CHECK: [[ID:%[0-9]+]] = function_ref @$s6callee7inherit8MMStringC_AB6MMFontCSgTg5 : $@convention(method) (@owned MMString, Int, @owned MMStorage<MMString, Optional<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, Optional<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, Optional<MMFont>>
}
// CHECK-LABEL: @$s6callee7inherit8MMStringC_AB6MMFontCSgTg5 : $@convention(method) (@owned MMString, Int, @owned MMStorage<MMString, Optional<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: Equatable) <τ_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: Equatable) <τ_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: Equatable) _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, Optional<MMFont>>.Type) -> @owned MMStorage<MMString, Optional<MMFont>>