Files
kotlin-fork/compiler/testData/codegen/bytecodeText/inline/entriesMappingOnCallSite.kt
T
Alexander Udalov db31f1f926 Tests: update some backend tests on enum entries
The enumEntriesIntrinsicMultipleEnums.kt test was supposed to check that
JVM backend generates 3 `$EntriesIntrinsicMappings` classes: for X, for
Y, and for Z. Mappings classes are generated for enums without
`entries`, i.e. Kotlin enums compiled without `EnumEntries` language
feature, and Java enums. The test incorrectly _enabled_ the language
feature for X though, and `$EntriesIntrinsicMappings` for X was
generated anyway because of KT-61208.

To keep the original intention of the test, I'm disabling the language
feature for X, so that it will be considered as enum without `entries`.
KT-61208 will be fixed in a separate commit (with separate tests).

The boxInline and bytecodeText tests changed their meaning when language
feature EnumEntries started to be enabled by default, so those changes
are a continuation to ebd43fc8c0. The behavior did not change after
enabling the feature, once again because of KT-61208.

Also, remove obsolete error suppressions which are no longer needed
after 64c8ce18a0.
2023-10-16 20:22:20 +00:00

33 lines
638 B
Kotlin
Vendored

// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// WITH_RUNTIME
// MODULE: lib
// !LANGUAGE: -EnumEntries
// FILE: 1.kt
enum class X {
O,
K
}
// MODULE: caller(lib)
// !LANGUAGE: +EnumEntries
// FILE: F.kt
inline fun test(idx: Int, block: () -> String): String {
return block()
}
@OptIn(ExperimentalStdlibApi::class)
fun box(): String {
return test(0) { X.entries[0].toString() } +
test(1) { X.entries[1].toString() }
}
// no additional mappings cause when in inline lambda (same module)
// 1 class FKt\$EntriesMappings
// 1 Lkotlin\/enums\/EnumEntries; entries\$0
// 0 Lkotlin\/enums\/EnumEntries; entries\$1