JVM IR: Don't generate bridges for default argument stubs (KT-46389)
This commit is contained in:
committed by
Alexander Udalov
parent
40b5a7d449
commit
1eb9a5a86d
@@ -0,0 +1,23 @@
|
||||
// IGNORE_BACKEND: JS, JS_IR
|
||||
|
||||
// The code in this test should be prohibited in the frontend, see KT-36188.
|
||||
|
||||
// This test fails with an IllegalStateException on the JS(-IR) backend,
|
||||
// but the behavior would probably not match the JVM backend even if
|
||||
// the test passed. Compare with kt46389_jvmDefault.
|
||||
|
||||
interface I {
|
||||
fun h(x: String = "O"): Any
|
||||
}
|
||||
|
||||
interface I2 : I
|
||||
|
||||
open class A {
|
||||
inline fun h(x: String = "K") = x
|
||||
}
|
||||
|
||||
class B : A(), I2
|
||||
|
||||
fun box(): String {
|
||||
return "${(B() as I).h()}${B().h()}"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// IGNORE_BACKEND: JS, JS_IR
|
||||
// !JVM_DEFAULT_MODE: all
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
// The code in this test should be prohibited in the frontend, see KT-36188.
|
||||
|
||||
// Before the fix to kt46389, the IR backend would have added a bridge
|
||||
// for `h$default` in `B`, which would have lead both calls to use "K"
|
||||
// as the default value. This would arguably be less surprising, but is
|
||||
// impossible to match without jvm-default on the JVM(-IR)backend.
|
||||
//
|
||||
// Meanwhile, the two calls using "K" as the default value is the current
|
||||
// behavior on the JS backend, which is why the test is muted for the JS
|
||||
// backend.
|
||||
|
||||
interface I {
|
||||
fun h(x: String = "O"): Any
|
||||
}
|
||||
|
||||
interface I2 : I
|
||||
|
||||
open class A {
|
||||
fun h(x: String = "K") = x
|
||||
}
|
||||
|
||||
class B : A(), I2
|
||||
|
||||
fun box(): String {
|
||||
return "${(B() as I).h()}${B().h()}"
|
||||
}
|
||||
Reference in New Issue
Block a user