Files
kotlin-fork/compiler/testData/codegen/box/enum/refToThis.kt
T
Georgy Bronnikov ed6ca7d67e JVM_IR: fix for SingletonReferencesLowering
When replacing an enum entry reference with `this`, you need to take
`this` from the function's `dispatchReceiverParameter`, not the class's
`thisReceiver`. Otherwise the code generator fails to find the reference
among accessible variables.
2019-10-16 13:19:40 +03:00

13 lines
220 B
Kotlin
Vendored

enum class Enum {
ENUM_VALUE {
override fun test() = ENUM_VALUE
};
abstract fun test(): Enum
}
fun box(): String {
if (Enum.ENUM_VALUE.test() != Enum.ENUM_VALUE) return "fail"
return "OK"
}