Files
kotlin-fork/compiler/testData/codegen/box/classes/classObjectAsStaticInitializer.kt
T
2021-10-02 06:14:35 +00:00

31 lines
440 B
Kotlin
Vendored

// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: NATIVE
var global = "A"
class C {
init {
global += "D"
}
companion object {
init {
global += "B"
}
init {
global += "C"
}
}
}
fun box(): String {
if (global != "A") {
return "fail1: global = $global"
}
val c = C()
if (global == "ABCD") return "OK" else return "fail2: global = $global"
}