mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 15:53:40 +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
17 lines
206 B
Kotlin
17 lines
206 B
Kotlin
class A(val result: String)
|
|
|
|
fun a(body: A.() -> String): String {
|
|
val r = A("OK")
|
|
return r.body()
|
|
}
|
|
|
|
object C {
|
|
private fun A.f() = result
|
|
|
|
val g = a {
|
|
f()
|
|
}
|
|
}
|
|
|
|
fun box() = C.g
|