Files
kotlin-fork/compiler/testData/codegen/box/compileKotlinAgainstKotlin/clashingFakeOverrideSignatures.kt
T
Dmitriy Novozhilov 89b98ef784 [FIR2IR] Properly create FIR f/o for lazy IR f/o
```kotlin
interface A {
    fun foo() // (1)
}

interface B : A {
    // f/o fun foo() // (2)
}
```

In previous commits it was forgotten to create new FIR declarations for
  IR fake-overrides, which led to the situation when `IR lazy functions
  of `(1)` and `(2)` both contained fir of function (1) as their base
  declaration

It seems this change fixed some cases from KT-42020
2023-11-20 13:36:28 +00:00

39 lines
813 B
Kotlin
Vendored

// IGNORE_BACKEND_K2: JS_IR
// IGNORE_BACKEND: NATIVE
// IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION
// Reason: KT-42020
// MODULE: lib
// FILE: a.kt
package a
open class Base<T> {
fun foo(x: T) = "x:$x"
fun foo(y: String) = "y:$y"
}
// MODULE: main(lib)
// FILE: b.kt
import a.Base
open class Derived : Base<String>()
fun box(): String {
val b = Base<String>()
val test1 = b.foo(x = "O") + b.foo(y = "K")
if (test1 != "x:Oy:K")
throw Exception("test1: $test1")
val d = Derived()
val test2 = d.foo(x = "O") + d.foo(y = "K")
if (test2 != "x:Oy:K")
throw Exception("test2: $test2")
val bd: Base<String> = Derived()
val test4 = bd.foo(x = "O") + bd.foo(y = "K")
if (test4 != "x:Oy:K")
throw Exception("test4: $test4")
return "OK"
}