mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 15:53:37 +00:00
Call object's constructor in <clinit> and ignore the result, but in the first line of <init> save the current "this" to INSTANCE$ #KT-4516 Fixed #KT-4543 Fixed #KT-5291 Fixed #KT-5523 Fixed #KT-5582 Fixed
15 lines
156 B
Kotlin
15 lines
156 B
Kotlin
trait T {
|
|
fun foo(): String
|
|
}
|
|
|
|
val o = object : T {
|
|
val a = "OK"
|
|
val f = {
|
|
a
|
|
}()
|
|
|
|
override fun foo() = f
|
|
}
|
|
|
|
fun box() = o.foo()
|