Files
kotlin-fork/compiler/testData/codegen/box/enum/enumEntriesIntrinsicForJava.kt
T
2023-07-25 09:55:43 +00:00

30 lines
703 B
Kotlin
Vendored

// TARGET_BACKEND: JVM_IR
// !OPT_IN: kotlin.ExperimentalStdlibApi
// WITH_STDLIB
// FILE: Z.java
public enum Z {
O, K
}
// FILE: box.kt
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") // TODO: remove once KT-53154 is fixed.
import kotlin.enums.*
fun callFromOtherFunctionInTheSameFile(): EnumEntries<Z> = enumEntries<Z>()
fun box(): String {
val z = enumEntries<Z>()
if (z.toString() != "[O, K]") return "Fail 1: $z"
val z2 = enumEntries<Z>()
if (z2 !== z) return "Fail 2: another instance of EnumEntries is created"
val z3 = callFromOtherFunctionInTheSameFile()
if (z3 !== z) return "Fail 3: another instance of EnumEntries is created"
return "OK"
}