Files
kotlin-fork/compiler/testData/codegen/bytecodeText/enum/enumEntriesIntrinsic.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

21 lines
505 B
Kotlin
Vendored

// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// !OPT_IN: kotlin.ExperimentalStdlibApi
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") // TODO: remove once KT-53154 is fixed.
import kotlin.enums.*
enum class MyEnum {
E
}
inline fun <reified T : Enum<T>> enumEntries2(): EnumEntries<T> = enumEntries<T>()
fun foo() {
enumEntries<MyEnum>()
enumEntries2<MyEnum>()
}
// There should be one call to enumEntries in MyEnum.<clinit>.
// 1 INVOKESTATIC kotlin/enums/EnumEntriesKt.enumEntries