mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 08:31:29 +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
21 lines
282 B
Kotlin
21 lines
282 B
Kotlin
trait T
|
|
|
|
object Foo {
|
|
private fun foo(p: T) = p
|
|
|
|
private val v: Int = {
|
|
val x = foo(O)
|
|
42
|
|
}()
|
|
|
|
private object O : T
|
|
|
|
val result = v
|
|
}
|
|
|
|
fun box(): String {
|
|
val foo = Foo
|
|
if (foo.result != 42) return "Fail: ${foo.result}"
|
|
return "OK"
|
|
}
|