mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
23 lines
409 B
Kotlin
Vendored
23 lines
409 B
Kotlin
Vendored
// Enable for JS when it supports initializer of companion objects.
|
|
// TARGET_BACKEND: JVM
|
|
// see https://youtrack.jetbrains.com/issue/KT-11086
|
|
var global = 0;
|
|
|
|
class C {
|
|
companion object {
|
|
init {
|
|
global = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
if (global != 0) {
|
|
return "fail1: global = $global"
|
|
}
|
|
|
|
val c = C()
|
|
if (global == 1) return "OK" else return "fail2: global = $global"
|
|
}
|
|
|