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
This commit is contained in:
+4
-4
@@ -10,16 +10,16 @@ class A {
|
||||
fun test() {
|
||||
val p = A::foo
|
||||
|
||||
checkSubtype<KMemberProperty<A, Int>>(p)
|
||||
checkSubtype<KMutableMemberProperty<A, Int>>(<!TYPE_MISMATCH!>p<!>)
|
||||
checkSubtype<KProperty1<A, Int>>(p)
|
||||
checkSubtype<KMutableProperty1<A, Int>>(<!TYPE_MISMATCH!>p<!>)
|
||||
checkSubtype<Int>(p.get(A()))
|
||||
p.get(<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
p.<!UNRESOLVED_REFERENCE!>set<!>(A(), 239)
|
||||
|
||||
val q = A::bar
|
||||
|
||||
checkSubtype<KMemberProperty<A, String>>(q)
|
||||
checkSubtype<KMutableMemberProperty<A, String>>(q)
|
||||
checkSubtype<KProperty1<A, String>>(q)
|
||||
checkSubtype<KMutableProperty1<A, String>>(q)
|
||||
checkSubtype<String>(q.get(A()))
|
||||
q.set(A(), "q")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user