bcfafc601e
This change allows to revert adding `WITH_STDLIB` directive to tests which happened at `a9343aeb`. Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
73 lines
1.2 KiB
Kotlin
Vendored
73 lines
1.2 KiB
Kotlin
Vendored
// DONT_TARGET_EXACT_BACKEND: JS
|
|
// DONT_TARGET_EXACT_BACKEND: JS_IR
|
|
// DONT_TARGET_EXACT_BACKEND: JS_IR_ES6
|
|
// DONT_TARGET_EXACT_BACKEND: WASM
|
|
// IGNORE_BACKEND: NATIVE
|
|
var result = ""
|
|
|
|
enum class E(a: String) {
|
|
X("x"),
|
|
Y("y");
|
|
|
|
init {
|
|
result += "E.init($a);"
|
|
}
|
|
|
|
companion object {
|
|
init {
|
|
result += "E.companion.init;"
|
|
val value = E.values()[0].name
|
|
result += "$value;"
|
|
}
|
|
}
|
|
}
|
|
|
|
enum class F(a: String) {
|
|
X("x"),
|
|
Y("y");
|
|
|
|
init {
|
|
result += "F.init($a);"
|
|
}
|
|
|
|
companion object {
|
|
init {
|
|
result += "F.companion.init;"
|
|
}
|
|
|
|
fun foo() {
|
|
result += "F.foo();$X;"
|
|
}
|
|
}
|
|
}
|
|
|
|
enum class G(a: String) {
|
|
X("x"),
|
|
Y("y");
|
|
|
|
init {
|
|
result += "G.init($a);"
|
|
}
|
|
|
|
object O {
|
|
init {
|
|
result += "G.O.init;"
|
|
}
|
|
|
|
fun foo() {
|
|
result += "G.O.foo();$X;"
|
|
}
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
val y = E.Y
|
|
result += "${y.name};"
|
|
F.foo()
|
|
G.O.foo()
|
|
if (result != "E.init(x);E.init(y);E.companion.init;X;Y;F.init(x);F.init(y);F.companion.init;F.foo();X;G.O.init;G.O.foo();X;")
|
|
return "fail: $result"
|
|
|
|
return "OK"
|
|
}
|