Fixed a bug where DEFAULT_CONSTRUCTOR_MARKER appeared twice as an argument

#KT-27598 Fixed

Co-authored-by: Alexander Udalov <alexander.udalov@jetbrains.com>
This commit is contained in:
wrongwrong
2022-02-20 17:44:44 +09:00
committed by Alexander Udalov
parent 5851f757f5
commit a1b6c9f546
3 changed files with 24 additions and 15 deletions
@@ -14,33 +14,32 @@ class C {
fun topLevel(c: S, d: S = S("d")): S = c + d
/* TODO: support constructors with inline class types in the signature (KT-26765)
class D(e: S, f: S = S("f")) {
val result = e + 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("ab"),
C::member.callBy(C::member.parameters.filter { it.name != "b" }.associateWith { (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("cd"), ::topLevel.callBy(::topLevel.parameters.filter { it.name != "d" }.associateWith { S("c") }))
// assertEquals(S("ef"), ::D.callBy(::D.parameters.filter { it.name != "f" }.associate { it to S("e") }).result)
assertEquals(S("ef"), ::D.callBy(::D.parameters.filter { it.name != "f" }.associateWith { 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") }))
assertEquals(S("gh"), S::extension.callBy(S::extension.parameters.filter { it.name != "h" }.associateWith { S("g") }))
val boundMember = C()::member
assertEquals(S("ab"), boundMember.callBy(boundMember.parameters.associate { it to S(it.name!!) }))
assertEquals(S("ab"), boundMember.callBy(boundMember.parameters.associateWith { S(it.name!!) }))
val boundExtension = S("g")::extension
assertEquals(S("gh"), boundExtension.callBy(boundExtension.parameters.associate { it to S(it.name!!) }))
assertEquals(S("gh"), boundExtension.callBy(boundExtension.parameters.associateWith { S(it.name!!) }))
return "OK"
}