[Test] Reformat test for KT-57105 and add an additional case to it

This commit is contained in:
Dmitriy Novozhilov
2023-11-27 17:55:19 +02:00
committed by Space Team
parent 8e047e6d8a
commit f5028bfc27
3 changed files with 526 additions and 14 deletions
@@ -1,29 +1,45 @@
// ISSUE: KT-57105
// IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION
// DUMP_IR
class RootBus: MessageBusImpl()
open class MessageBusImpl {
val parentBus: Any?
// simpleCase
open class Base_1 {
val x: Any?
val y: Any?
init {
this as RootBus
parentBus = "O"
this as Derived_1
x = "O"
this.y = "O"
}
}
class RootBus2: CompositeMessageBus2()
class Derived_1: Base_1()
open class CompositeMessageBus2: MessageBusImpl2()
open class MessageBusImpl2 {
val parentBus: Any?
// deep hierarchy
open class Base_2 {
val x: Any?
val y: Any?
init {
this as RootBus2
parentBus = "K"
this as Impl_2
x = "K"
this.y = "K"
}
}
open class Derived_2: Base_2()
class Impl_2: Derived_2()
fun box(): String {
return "" + RootBus().parentBus + RootBus2().parentBus
val a = Derived_1()
val b = Impl_2()
val res1 = "" + a.x + b.x
val res2 = "" + a.y + b.y
if (res1 != "OK") return "Fail implicit: $res1"
if (res2 != "OK") return "Fail explicit: $res2"
return "OK"
}