Fix initialization of inner class instances in enum entries

In an inner class of the enum entry class, enum entry reference should
be generated as an outer 'this', not as a enum entry access, because
enum entry itself may be not initialized yet.
This commit is contained in:
Dmitry Petrov
2017-09-08 12:35:25 +03:00
parent 26b2f59b86
commit 66ece54b25
6 changed files with 65 additions and 1 deletions
@@ -0,0 +1,20 @@
// LANGUAGE_VERSION: 1.2
enum class A {
X {
val x = "OK"
inner class Inner {
val y = x
}
val z = Inner()
override val test: String
get() = z.y
};
abstract val test: String
}
fun box() = A.X.test