Fix enum entry reference from enum entry initialization context
Enum entries are "special" kind of singletons that should be referenced as a captured 'this' instance inside during entry initialization, because corresponding static fields in enum class are not initialized yet. #KT-7257 Fixed
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
enum class X {
|
||||
B {
|
||||
override val value = "OK"
|
||||
|
||||
override val test = ::value.get()
|
||||
};
|
||||
|
||||
abstract val value: String
|
||||
|
||||
abstract val test: String
|
||||
}
|
||||
|
||||
fun box() = X.B.test
|
||||
Reference in New Issue
Block a user