Use 'mapToCallableMethod' for delegateTo signature calculation
#KT-9707 Fixed
This commit is contained in:
@@ -916,7 +916,7 @@ public class FunctionCodegen {
|
||||
@NotNull MethodContext context,
|
||||
@NotNull MemberCodegen<?> parentCodegen
|
||||
) {
|
||||
Method delegateToMethod = typeMapper.mapSignature(delegatedTo).getAsmMethod();
|
||||
Method delegateToMethod = typeMapper.mapToCallableMethod(delegatedTo, /* superCall = */ false).getAsmMethod();
|
||||
Method delegateMethod = typeMapper.mapSignature(delegateFunction).getAsmMethod();
|
||||
|
||||
Type[] argTypes = delegateMethod.getArgumentTypes();
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
open class Content() {
|
||||
override fun toString() = "OK"
|
||||
}
|
||||
|
||||
interface Box<E> {
|
||||
fun get(): E
|
||||
}
|
||||
|
||||
interface ContentBox<T : Content> : Box<T>
|
||||
|
||||
object Impl : ContentBox<Content> {
|
||||
override fun get(): Content = Content()
|
||||
}
|
||||
|
||||
class ContentBoxDelegate<T : Content>() : ContentBox<T> by (Impl as ContentBox<T>)
|
||||
|
||||
fun box() = ContentBoxDelegate<Content>().get().toString()
|
||||
@@ -0,0 +1,18 @@
|
||||
import java.util.*
|
||||
|
||||
open class Content() {
|
||||
override fun toString() = "OK"
|
||||
}
|
||||
|
||||
interface ContentBox<T : Content> : List<T>
|
||||
|
||||
object Impl : ContentBox<Content> , AbstractList<Content>() {
|
||||
override fun get(index: Int) = Content()
|
||||
|
||||
override val size: Int
|
||||
get() = throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
class ContentBoxDelegate<T : Content>() : ContentBox<T> by (Impl as ContentBox<T>)
|
||||
|
||||
fun box() = ContentBoxDelegate<Content>()[0].toString()
|
||||
+12
@@ -418,6 +418,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("delegationComplex.kt")
|
||||
public void testDelegationComplex() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/delegationComplex.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("delegationComplexWithList.kt")
|
||||
public void testDelegationComplexWithList() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/delegationComplexWithList.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("delegationProperty.kt")
|
||||
public void testDelegationProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/delegationProperty.kt");
|
||||
|
||||
@@ -59,6 +59,18 @@ public class BridgeTestGenerated extends AbstractBridgeTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("delegationComplex.kt")
|
||||
public void testDelegationComplex() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/delegationComplex.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("delegationComplexWithList.kt")
|
||||
public void testDelegationComplexWithList() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/delegationComplexWithList.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("delegationProperty.kt")
|
||||
public void testDelegationProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/delegationProperty.kt");
|
||||
|
||||
Reference in New Issue
Block a user