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.
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
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"
|
||||
}
|
||||
Reference in New Issue
Block a user