Fix callable reference to member of generic class

This commit is contained in:
Alexander Udalov
2015-07-27 14:55:45 +03:00
parent 49a8c7a947
commit a93484b457
3 changed files with 19 additions and 1 deletions
@@ -326,7 +326,7 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
if (generateBody) {
mv.visitCode();
InstructionAdapter iv = new InstructionAdapter(mv);
Method method = typeMapper.mapSignature(descriptor).getAsmMethod();
Method method = typeMapper.mapSignature(descriptor.getOriginal()).getAsmMethod();
iv.aconst(method.getName() + method.getDescriptor());
iv.areturn(JAVA_STRING_TYPE);
FunctionCodegen.endVisit(iv, "function reference getSignature", element);
@@ -0,0 +1,12 @@
var result = "Fail"
class A<T> {
fun foo(t: T) {
result = t as String
}
}
fun box(): String {
(A<String>::foo).call(A<String>(), "OK")
return result
}
@@ -2799,6 +2799,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
doTestWithStdlib(fileName);
}
@TestMetadata("memberOfGenericClass.kt")
public void testMemberOfGenericClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/call/memberOfGenericClass.kt");
doTestWithStdlib(fileName);
}
@TestMetadata("platformStatic.kt")
public void testPlatformStatic() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/call/platformStatic.kt");