[JS IR] Remove redundant guard assertion for extension funs with default params

Introduce corresponding test
See https://youtrack.jetbrains.com/issue/KT-41076
This commit is contained in:
Shagen Ogandzhanian
2020-12-02 16:45:12 +01:00
parent a917ebd11e
commit d512158c25
9 changed files with 77 additions and 3 deletions
@@ -0,0 +1,38 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: NATIVE
open class MyLogic {
protected open val postfix = "ZZZ"
open fun String.foo(prefix: String = "XXX"): String = transform(prefix + this + postfix)
protected fun transform(a: String) = "$a:$a"
fun result(): String {
return "YYY".foo()
}
}
open class MyLogicWithDifferentPostfix : MyLogic() {
override val postfix = "WWW"
}
class MyLogicSpecified : MyLogic() {
override fun String.foo(prefix: String): String = "$prefix::$this::$postfix"
}
fun box(): String {
val result1 = MyLogic().result()
if (result1 != "XXXYYYZZZ:XXXYYYZZZ") {
return "fail1: ${result1}"
}
val result2 = MyLogicWithDifferentPostfix().result()
if (result2 != "XXXYYYWWW:XXXYYYWWW") {
return "fail2: ${result2}"
}
val result3 = MyLogicSpecified().result()
if (result3 != "XXX::YYY::ZZZ") {
return "fail3: ${result3}"
}
return "OK"
}