Files
kotlin-fork/compiler/testData/codegen/box/enum/kt7257_notInline.kt
T
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

13 lines
231 B
Kotlin
Vendored

fun <T, R> T.letNoInline(fn: (T) -> R) =
fn(this)
enum class X {
B {
val value2 = "K"
override val value = "O".letNoInline { it + value2 }
};
abstract val value: String
}
fun box() = X.B.value