JVM_IR: Fix default argument bit mask for methods made static.

When called by reflection the bit mask will be generated
discounting dispatch/extension receivers. Make sure that the
interpretation of the bit mask is consistent for direct and
reflective calls.

In addition, this also fixes the modifiers on java 8 parameter
metadata for the dispatch and extension receivers for these
inline class methods.
This commit is contained in:
Mads Ager
2020-01-03 11:28:43 +01:00
committed by max-kammerer
parent 137c500e3a
commit 1ed7e33f42
12 changed files with 126 additions and 10 deletions
@@ -1,5 +1,5 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR, JS, NATIVE, JVM_IR
// IGNORE_BACKEND: JS_IR, JS, NATIVE
// WITH_REFLECT
import kotlin.test.assertEquals
@@ -23,17 +23,19 @@ class D(e: S, f: S = S("f")) {
fun S.extension(h: S = S("h")): S = this + h
fun box(): String {
assertEquals(S("ab"), C().member(S("a")))
assertEquals(S("ab"), C::member.callBy(C::member.parameters.filter { it.name != "b" }.associate {
it to (if (it.name == "a") S("a") else C())
}))
assertEquals(S("cd"), topLevel(S("c")))
assertEquals(S("cd"), ::topLevel.callBy(::topLevel.parameters.filter { it.name != "d" }.associate { it to S("c") }))
// assertEquals(S("ef"), ::D.callBy(::D.parameters.filter { it.name != "f" }.associate { it to S("e") }).result)
assertEquals(S("gh"), S("g").extension())
assertEquals(S("gh"), S::extension.callBy(S::extension.parameters.filter { it.name != "h" }.associate { it to S("g") }))
val boundMember = C()::member
assertEquals(S("ab"), boundMember.callBy(boundMember.parameters.associate { it to S(it.name!!) }))