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:
Georgy Bronnikov
2019-10-15 12:20:02 +03:00
parent fa44cab9dc
commit ed6ca7d67e
7 changed files with 56 additions and 23 deletions
+12
View File
@@ -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"
}