Fix JvmOverloads generation for actual methods

`countDefaultParameters` uses `hasDefaultValue` to compute the number of
parameters which have default values, which handles actual parameters
(who have default values in the expected declaration) correctly. Thus,
`getRemainingParameters` should use it as well to determine the list of
parameters to be skipped in each generated overload

 #KT-23910 Fixed
This commit is contained in:
Alexander Udalov
2018-04-23 13:58:47 +02:00
parent 516e7df4b7
commit a8488cf298
5 changed files with 47 additions and 1 deletions
@@ -0,0 +1,31 @@
// !LANGUAGE: +MultiPlatformProjects
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: J.java
public class J {
public static String test() {
JvmKt.foo(-1);
JvmKt.foo(5, 5);
return "OK";
}
}
// FILE: common.kt
expect fun foo(j: Int, i: Int = -1)
// FILE: jvm.kt
import kotlin.test.assertEquals
@JvmOverloads
actual fun foo(j: Int, i: Int) {
assertEquals(j, i)
}
fun box(): String {
foo(-1)
foo(5, 5)
return J.test();
}