Generate INVOKESPECIAL instruction for private method with default argument
This commit is contained in:
@@ -687,7 +687,7 @@ public class FunctionCodegen extends GenerationStateAware {
|
|||||||
iv.invokeinterface(internalName, jvmSignatureName, jvmSignatureDescriptor);
|
iv.invokeinterface(internalName, jvmSignatureName, jvmSignatureDescriptor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!constructor) {
|
if (!constructor && functionDescriptor.getVisibility() != Visibilities.PRIVATE) {
|
||||||
iv.invokevirtual(internalName, jvmSignatureName, jvmSignatureDescriptor);
|
iv.invokevirtual(internalName, jvmSignatureName, jvmSignatureDescriptor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
// Check that this code doesn't contains INVOKEVIRTUAL instruction
|
||||||
|
class B {
|
||||||
|
private fun foo(i: Int = 1) {
|
||||||
|
}
|
||||||
|
|
||||||
|
fun f() {
|
||||||
|
foo(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -195,4 +195,11 @@ public class FunctionGenTest extends CodegenTestCase {
|
|||||||
public void testKt2929() {
|
public void testKt2929() {
|
||||||
blackBoxFile("regressions/kt2929.kt");
|
blackBoxFile("regressions/kt2929.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testPrivateDefaultArgs() throws Exception {
|
||||||
|
loadFile("functions/privateDefaultArgs.kt");
|
||||||
|
String text = generateToText();
|
||||||
|
assertFalse(text.contains("INVOKEVIRTUAL"));
|
||||||
|
assertTrue(text.contains("INVOKESPECIAL"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user