blob: 1e0dffe3d076d317539fbc55cff79d98869e446e [file] [log] [blame]
// RUN: %target-swift-frontend %s -emit-silgen -disable-objc-attr-requires-foundation-module -enable-objc-interop | %FileCheck %s
// rdar://15763213
// Make sure that we can parse SILDeclRef to an overloaded member.
import Swift
import Builtin
struct A {
init()
}
@objc class X {
init(a: A)
init(a1: A, a2: A)
}
// CHECK-LABEL: sil [ossa] @_TFCSo1XcfMS_FT1aV11peer_method1A_S_
sil [ossa] @_TFCSo1XcfMS_FT1aV11peer_method1A_S_ : $@convention(method) (A, @owned X) -> @owned X {
bb0(%0 : $A, %1 : @owned $X):
%2 = alloc_box $_0_0> { var τ_0_0 } <X>
%2a = project_box %2 : $_0_0> { var τ_0_0 } <X>, 0
%3 = alloc_box $_0_0> { var τ_0_0 } <A>
%3a = project_box %3 : $_0_0> { var τ_0_0 } <A>, 0
store %0 to [trivial] %3a : $*A
%5 = mark_uninitialized [delegatingself] %1 : $X
store %5 to [init] %2a : $*X
%7 = load [copy] %2a : $*X
// CHECK: objc_method %{{[0-9]+}} : $X, #X.init!initializer.1.foreign : (X.Type) -> (A, A) -> X, $@convention(objc_method) (A, A, @owned X) -> @owned X
%9 = objc_method %7 : $X, #X.init!initializer.1.foreign : (X.Type) -> (A, A) -> X, $@convention(objc_method) (A, A, @owned X) -> @owned X
%10 = load [trivial] %3a : $*A
%11 = load [trivial] %3a : $*A
%12 = apply %9(%10, %11, %7) : $@convention(objc_method) (A, A, @owned X) -> @owned X
assign %12 to %2a : $*X
destroy_value %3 : $_0_0> { var τ_0_0 } <A>
%15 = load [copy] %2a : $*X
destroy_value %2 : $_0_0> { var τ_0_0 } <X>
return %15 : $X
}