Files
kotlin/compiler/testData/codegen/box/enum/kt7257_boundReference1.kt
Dmitry Petrov 6b6d1e80f8 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
2017-09-12 11:00:24 +03:00

21 lines
305 B
Kotlin
Vendored

// LANGUAGE_VERSION: 1.2
enum class X {
B {
val k = "K"
inner class Inner {
fun foo() = "O" + k
}
val inner = Inner()
val bmr = inner::foo
override val value = bmr.invoke()
};
abstract val value: String
}
fun box() = X.B.value