Files
kotlin-fork/backend.native/tests/external/codegen/box/objects/interfaceCompanionObjectReference.kt
T
2017-11-16 17:21:48 +03:00

37 lines
653 B
Kotlin

// WITH_RUNTIME
import kotlin.test.*
interface Test {
companion object {
val x = "OK"
val y1 = Test.x
val y2 = 42.let { x }
val y3: String
init {
fun localFun() = x
y3 = localFun()
}
fun method() = x
val y4 = method()
val anonObject = object {
override fun toString() = x
}
val y5 = anonObject.toString()
init {
assertEquals(x, y1)
assertEquals(x, y2)
assertEquals(x, y3)
assertEquals(x, y4)
assertEquals(x, y5)
}
}
}
fun box() = Test.x