[FIR2IR] Treat delegated functions as fake-overrides
Delegated callables in FIR are session-dependant (as fake-overrides), so it's incorrect to use their FIR as a key for declaration storage. Pair of original function and owner lookup tag should be used instead ^KT-62671 Fixed
This commit is contained in:
committed by
Space Team
parent
3c68b27280
commit
940567978d
+24
@@ -0,0 +1,24 @@
|
||||
// IGNORE_BACKEND_K1: JS, JS_IR, JS_IR_ES6, NATIVE, WASM
|
||||
// LANGUAGE: +MultiPlatformProjects
|
||||
// ISSUE: KT-62671
|
||||
|
||||
// MODULE: common
|
||||
// FILE: common.kt
|
||||
interface A {
|
||||
fun foo(x: Int = 1): String
|
||||
}
|
||||
|
||||
class B : A {
|
||||
override fun foo(x: Int): String {
|
||||
return if (x == 1) "OK" else "Fail: $x"
|
||||
}
|
||||
}
|
||||
|
||||
class X(val delegate: A = B()) : A by delegate
|
||||
|
||||
// MODULE: platform()()(common)
|
||||
// FILE: platform.kt
|
||||
fun box(): String {
|
||||
val x = X()
|
||||
return x.foo()
|
||||
}
|
||||
Reference in New Issue
Block a user