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:
@@ -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
|
||||
Reference in New Issue
Block a user