mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
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
16 lines
287 B
Kotlin
Vendored
16 lines
287 B
Kotlin
Vendored
enum class X {
|
|
B {
|
|
val value2 = "K"
|
|
|
|
val anonObject = object {
|
|
override fun toString(): String =
|
|
"O" + value2
|
|
}
|
|
|
|
override val value = anonObject.toString()
|
|
};
|
|
|
|
abstract val value: String
|
|
}
|
|
|
|
fun box() = X.B.value |