Files
kotlin-fork/compiler/testData/codegen/box/enum/declaringClassOnEnumObject.kt
T
Nikolay Lunyak bcfafc601e Add EnumEntries to minimal-stdlib-for-tests
This change allows to revert adding `WITH_STDLIB` directive
to tests which happened at `a9343aeb`.

Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
2023-03-02 10:23:38 +00:00

18 lines
392 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// IGNORE_BACKEND_K2: JVM_IR
// K2 status: declaringClass is error for enums since Kotlin 1.9
// LANGUAGE: -ProhibitEnumDeclaringClass
package test
enum class KEnum { A }
fun test(e: KEnum): String {
return e.declaringClass.toString()
}
fun box(): String {
val result = test(KEnum.A)
return if (result == "class test.KEnum") "OK" else "fail: $result"
}