Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/delegates/delegateWithLambda.kt
T
2021-12-15 22:23:02 +03:00

18 lines
354 B
Kotlin
Vendored

import kotlin.reflect.KProperty
class LazyDelegate<T>(val value: T) {
operator fun getValue(thisRef: Any?, property: KProperty<*>): T = value
}
fun <T> lazy(block: () -> T): LazyDelegate<T> = LazyDelegate(block())
fun getAny(): Any? = null
fun <Q> materialize(): Q = null!!
class Test {
val x: String by lazy {
materialize()
}
}