Files
kotlin-fork/compiler/testData/diagnostics/tests/callableReference/property/memberFromExtension.kt
T
Alexander Udalov 30794060a9 Simplify property hierarchy in reflection
Leave only 3*2 = 6 classes: KProperty0, KProperty1, KProperty2 and their
mutable analogs, depending on the number of receivers a property takes
2015-07-10 20:10:09 +03:00

24 lines
423 B
Kotlin
Vendored

// !CHECK_TYPE
import kotlin.reflect.*
class A {
val foo: Unit = Unit
var bar: String = ""
var self: A
get() = this
set(value) { }
}
fun A.test() {
val x = ::foo
val y = ::bar
val z = ::self
checkSubtype<KProperty1<A, Unit>>(x)
checkSubtype<KMutableProperty1<A, String>>(y)
checkSubtype<KMutableProperty1<A, A>>(z)
y.set(z.get(A()), x.get(A()).toString())
}