mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
15 lines
215 B
Kotlin
Vendored
15 lines
215 B
Kotlin
Vendored
import kotlin.reflect.KProperty
|
|
|
|
class Delegate {
|
|
operator fun getValue(t: Any?, p: KProperty<*>): Int = 3
|
|
}
|
|
|
|
fun foo(): Int {
|
|
val prop: Int by Delegate()
|
|
return prop
|
|
}
|
|
|
|
val x = foo()
|
|
|
|
// expected: x: 3
|