correctly calculate the number of mask arguments required for a method with default arguments

#KT-6816 Fixed
This commit is contained in:
Dmitry Jemerov
2015-03-27 15:53:55 +01:00
parent 418034add3
commit 1e536af87e
3 changed files with 32 additions and 1 deletions
@@ -708,7 +708,7 @@ public class JetTypeMapper {
@NotNull
public static String getDefaultDescriptor(@NotNull Method method, boolean isExtension) {
String descriptor = method.getDescriptor();
int argumentsCount = (Type.getArgumentsAndReturnSizes(descriptor) >> 2) - 1;
int argumentsCount = Type.getArgumentTypes(descriptor).length;
if (isExtension) {
argumentsCount--;
}
@@ -0,0 +1,25 @@
public class CalculatorConstants(
val id: Long = 0,
val detour: Double = 0.0,
val taxi: Double = 0.0,
val loop: Double = 0.0,
val planeCondition: Double = 0.0,
val co2PerKerosene: Double = 0.0,
val freight: Double = 0.0,
val rfi: Double = 0.0,
val rfiAltitude: Double = 0.0,
val averageContribution: Double = 0.0,
val singleContribution: Double = 0.0,
val returnContribution: Double = 0.0,
val defraFactor: Double = 0.0,
val airCondMult: Double = 0.0,
val autoTransMult: Double = 0.0,
val hybridDefault: String? = null,
val travelClassOne: Double = 0.0,
val status: String = "OK"
)
fun box(): String {
val c = CalculatorConstants()
return c.status
}
@@ -1451,6 +1451,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("kt6816.kt")
public void testKt6816() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt6816.kt");
doTest(fileName);
}
@TestMetadata("kt707.kt")
public void testKt707() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt707.kt");