blob: a5867c2a47541343a651dd559ef2142682998127 [file]
// FILE: lib.kt
interface I {
fun foo(x: Int): Int
object Impl : I {
override fun foo(x: Int) = x
}
companion object {
fun impl(): I = Impl
fun getInitial() = 42
}
}
private var x = I.getInitial()
get() = I.impl().foo(field)
fun test(): Int {
return I.impl().foo(x)
}
class A() {
fun test() = x
}
// FILE: main.kt
fun box(): String {
if (A().test() != 42) return "fail 1"
if (test() != 42) return "fail 2"
return "OK"
}