Files
kotlin/compiler/testData/codegen/box/classes/classObjectAsStaticInitializer.kt
2019-11-19 11:00:09 +03:00

23 lines
346 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: NATIVE
// IGNORE_BACKEND: JS_IR
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"
}