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:
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user