mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 08:31:28 +00:00
23 lines
517 B
Kotlin
Vendored
23 lines
517 B
Kotlin
Vendored
// IGNORE_BACKEND: JVM_IR
|
|
// Inside of the companion we have to access the instance through the local Companion field,
|
|
// not by indirection through the Companion field of the enclosing class.
|
|
// Class initialization might not have finished yet.
|
|
var result = ""
|
|
|
|
interface A {
|
|
|
|
companion object {
|
|
|
|
val prop = test()
|
|
|
|
fun test(): String {
|
|
result += "OK"
|
|
return result
|
|
}
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
if (A.prop != "OK") return "fail ${A.prop}"
|
|
return result
|
|
} |