Files
kotlin-fork/compiler/testData/codegen/boxInline/enum/javaEnumEntries.kt
T
Alexander Udalov 874d1c514a JVM: support enumEntries intrinsic for Kotlin enums
Implementation is very similar to the `enumValues` intrinsic.

Java enums and old (pre-1.9) Kotlin enums will be supported in a
subsequent commit.

 #KT-59710
2023-07-25 09:55:43 +00:00

34 lines
540 B
Kotlin
Vendored

// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM_IR
// !OPT_IN: kotlin.ExperimentalStdlibApi
// WITH_STDLIB
// FILE: test/Z.java
package test;
public enum Z {
O, K
}
// FILE: 1.kt
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") // TODO: remove once KT-53154 is fixed.
package test
import kotlin.enums.enumEntries
inline fun <reified T : Enum<T>> myEntries(): String {
val values = enumEntries<T>()
return values.joinToString("")
}
// FILE: 2.kt
import test.*
fun box(): String {
return myEntries<Z>()
}