Files
kotlin-fork/compiler/testData/ir/interpreter/localObject.kt
T
2021-06-07 15:35:12 +03:00

20 lines
445 B
Kotlin
Vendored

@CompileTimeCalculation
interface LocalObject {
fun getNum(): Int
}
@CompileTimeCalculation
fun getLocalObject(num: Int) = object : LocalObject {
override fun getNum() = num
}
@CompileTimeCalculation
class A(val a: Int) {
val localObject = object : LocalObject {
override fun getNum() = a
}
}
const val a = getLocalObject(10).<!EVALUATED: `10`!>getNum()<!>
const val b = A(2).localObject.<!EVALUATED: `2`!>getNum()<!>