blob: 6632c0f835d91c012cde9c7099a27d9bced2c3d9 [file] [log] [blame]
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all %s -devirtualizer -sil-combine -enable-resilience | %FileCheck %s
sil_stage canonical
import Builtin
protocol P {
func f()
}
extension P {
func f()
}
class C<T, U> : P {}
sil hidden_external [transparent] [thunk] @witness_thunk : $@convention(witness_method: P) _0_0><τ_1_0, τ_1_1 where τ_0_0 : C_1_0, τ_1_1>> (@in_guaranteed τ_0_0) -> ()
// CHECK-LABEL: sil hidden @caller : $@convention(thin) <T, U> (@owned C<T, U>) -> ()
// CHECK: [[FN:%.*]] = function_ref @witness_thunk
// CHECK: apply [[FN]]<C<T, U>, T, U>(
// CHECK: return
sil hidden @caller : $@convention(thin) <T, U> (@owned C<T, U>) -> () {
bb0(%0 : $C<T, U>):
strong_retain %0 : $C<T, U>
%4 = alloc_stack $C<T, U>
store %0 to %4 : $*C<T, U>
%6 = witness_method $C<T, U>, #P.f!1 : <Self where Self : P> (Self) -> () -> () : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> ()
%7 = apply %6<C<T, U>>(%4) : $@convention(witness_method: P) _0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> ()
dealloc_stack %4 : $*C<T, U>
strong_release %0 : $C<T, U>
%9 = tuple ()
return %9 : $()
}
sil_vtable C {}
sil_witness_table hidden <T, U> C<T, U>: P module clsx {
method #P.f!1: <Self where Self : P> (Self) -> () -> () : @witness_thunk
}
sil_default_witness_table hidden P {
}