Do not count receivers in default parameters mask

If we implement default function with default parameters in inline
class, the receivers will be added to parameter list
(see ac7538a269). But since they
are not present in source parameters, we should not count them when we
compute mask for default parameters.

 #KT-49977 Fixed
This commit is contained in:
Ilmir Usmanov
2021-11-29 19:25:57 +01:00
committed by Space
parent 7ccd1309e6
commit 8e8a6e6108
17 changed files with 304 additions and 9 deletions
@@ -0,0 +1,24 @@
// WITH_STDLIB
// !JVM_DEFAULT_MODE: all-compatibility
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// JVM_TARGET: 1.8
interface Path {
fun dispatch(s: String = "K") = "dispatch$s"
fun Int.extension(s: String = "K") = "${this}extension$s"
}
@JvmInline
value class RealPath(val x: Int) : Path
fun box(): String {
val rp = RealPath(1)
val res = "${rp.dispatch()};${rp.dispatch("KK")};" +
with(rp) {
"${1.extension()};${2.extension("KK")}"
}
if (res != "dispatchK;dispatchKK;1extensionK;2extensionKK") return res
return "OK"
}
@@ -0,0 +1,25 @@
// WITH_STDLIB
// !JVM_DEFAULT_MODE: all
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// JVM_TARGET: 1.8
interface Path {
fun dispatch(s: String = "K") = "dispatch$s"
fun Int.extension(s: String = "K") = "${this}extension$s"
}
@JvmInline
value class RealPath(val x: Int) : Path
fun box(): String {
val rp = RealPath(1)
val res = "${rp.dispatch()};${rp.dispatch("KK")};" +
with(rp) {
"${1.extension()};${2.extension("KK")}"
}
if (res != "dispatchK;dispatchKK;1extensionK;2extensionKK") return res
return "OK"
}
@@ -0,0 +1,24 @@
// WITH_STDLIB
// !JVM_DEFAULT_MODE: compatibility
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// JVM_TARGET: 1.8
interface Path {
fun dispatch(s: String = "K") = "dispatch$s"
fun Int.extension(s: String = "K") = "${this}extension$s"
}
@JvmInline
value class RealPath(val x: Int) : Path
fun box(): String {
val rp = RealPath(1)
val res = "${rp.dispatch()};${rp.dispatch("KK")};" +
with(rp) {
"${1.extension()};${2.extension("KK")}"
}
if (res != "dispatchK;dispatchKK;1extensionK;2extensionKK") return res
return "OK"
}
@@ -0,0 +1,23 @@
// WITH_STDLIB
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// JVM_TARGET: 1.8
interface Path {
fun dispatch(s: String = "K") = "dispatch$s"
fun Int.extension(s: String = "K") = "${this}extension$s"
}
@JvmInline
value class RealPath(val x: Int) : Path
fun box(): String {
val rp = RealPath(1)
val res = "${rp.dispatch()};${rp.dispatch("KK")};" +
with(rp) {
"${1.extension()};${2.extension("KK")}"
}
if (res != "dispatchK;dispatchKK;1extensionK;2extensionKK") return res
return "OK"
}