mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 08:31:26 +00:00
19 lines
261 B
Kotlin
Vendored
19 lines
261 B
Kotlin
Vendored
import kotlin.reflect.*
|
|
|
|
class A {
|
|
val x = 1
|
|
fun x(): String = "OK"
|
|
}
|
|
|
|
val f1: KProperty1<A, Int> = A::x
|
|
val f2: (A) -> String = A::x
|
|
|
|
fun box(): String {
|
|
val a = A()
|
|
|
|
val x1 = f1.get(a)
|
|
if (x1 != 1) return "Fail 1: $x1"
|
|
|
|
return f2(a)
|
|
}
|