Map proper owner for method with default args

This commit is contained in:
Michael Bogdanov
2016-09-12 14:35:57 +03:00
parent 0390cd6ee1
commit 5f1f4a067d
3 changed files with 22 additions and 1 deletions
@@ -658,7 +658,9 @@ public class KotlinTypeMapper {
baseMethodDescriptor = findBaseDeclaration(functionDescriptor).getOriginal();
ClassDescriptor ownerForDefault = (ClassDescriptor) baseMethodDescriptor.getContainingDeclaration();
ownerForDefaultImpl = isJvmInterface(ownerForDefault) ? mapDefaultImpls(ownerForDefault) : mapClass(ownerForDefault);
ownerForDefaultImpl =
isJvmInterface(ownerForDefault) && (state == null || !isJvm8Interface(ownerForDefault, state)) ?
mapDefaultImpls(ownerForDefault) : mapClass(ownerForDefault);
if (isInterface && (superCall || descriptor.getVisibility() == Visibilities.PRIVATE || isAccessor(descriptor))) {
thisClass = mapClass(currentOwner);
+13
View File
@@ -0,0 +1,13 @@
// JVM_TARGET: 1.8
interface Z {
fun test(s: String = "OK"): String {
return s
}
}
class Test: Z
fun box(): String {
return Test().test()
}
@@ -139,6 +139,12 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
doTest(fileName);
}
@TestMetadata("defaultArgs.kt")
public void testDefaultArgs() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/jvm8/defaultArgs.kt");
doTest(fileName);
}
@TestMetadata("diamond.kt")
public void testDiamond() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/jvm8/diamond.kt");