Files
kotlin-fork/compiler/testData/ir/irText/declarations/delegate/delegationEvaluationOrder2.kt.txt
T
2024-02-16 10:19:38 +00:00

163 lines
2.8 KiB
Kotlin
Vendored

package foo
var global: String
field = ""
get
set
class Base2Impl : Base2 {
val s: String
field = s
get
constructor(s: String) /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun bar(x: String): String {
return "Base2: " + <this>.<get-s>() + ":" + x
}
}
class BaseImpl : Base {
val s: String
field = s
get
constructor(s: String) /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun foo(x: String): String {
return "Base: " + <this>.<get-s>() + ":" + x
}
}
class Derived : DerivedBase, Base, Base2 {
private /* final field */ val $$delegate_0: Base = newBase()
private /* final field */ val $$delegate_1: Base2 = newBase2()
init {
{ // BLOCK
<set-global>(<set-?> = <get-global>().plus(other = ":Derived"))
}
}
constructor() /* primary */ {
super/*DerivedBase*/()
/* <init>() */
}
override fun bar(x: String): String {
return <this>.#$$delegate_1.bar(x = x)
}
override fun foo(x: String): String {
return <this>.#$$delegate_0.foo(x = x)
}
}
class Derived1 : DerivedBase, Base, Base2 {
private /* final field */ val $$delegate_0: Base = newBase()
private /* final field */ val $$delegate_1: Base2 = newBase2()
init {
{ // BLOCK
<set-global>(<set-?> = <get-global>().plus(other = ":Derived"))
}
}
constructor() /* primary */ {
super/*DerivedBase*/()
/* <init>() */
}
override fun bar(x: String): String {
return <this>.#$$delegate_1.bar(x = x)
}
override fun foo(x: String): String {
return <this>.#$$delegate_0.foo(x = x)
}
}
class Derived2 : DerivedBase, Base, Base2 {
private /* final field */ val $$delegate_0: Base = newBase()
private /* final field */ val $$delegate_1: Base2 = newBase2()
init {
{ // BLOCK
<set-global>(<set-?> = <get-global>().plus(other = ":Derived"))
}
}
constructor() /* primary */ {
super/*DerivedBase*/()
/* <init>() */
}
override fun bar(x: String): String {
return <this>.#$$delegate_1.bar(x = x)
}
override fun foo(x: String): String {
return <this>.#$$delegate_0.foo(x = x)
}
}
open class DerivedBase {
init {
{ // BLOCK
<set-global>(<set-?> = <get-global>().plus(other = ":DerivedBase"))
}
}
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
interface Base {
abstract fun foo(x: String): String
}
interface Base2 {
abstract fun bar(x: String): String
}
fun box(): String {
var d: Derived = Derived()
var d1: Derived1 = Derived1()
var d2: Derived2 = Derived2()
return "OK"
}
fun newBase(): Base {
{ // BLOCK
<set-global>(<set-?> = <get-global>().plus(other = ":newBase"))
}
return BaseImpl(s = "test")
}
fun newBase2(): Base2 {
{ // BLOCK
<set-global>(<set-?> = <get-global>().plus(other = ":newBase2"))
}
return Base2Impl(s = "test")
}