Supported KProperty2 and KMutableProperty2 for delegated properties

Consider this code:
object Delegate {
    operator fun getValue(t: Any?, p: KProperty<*>): String {
        return ""
    }
}

class A {
    val String.ext by Delegate
}

then the type of <p> is KProperty2 (it has 2 receivers).

Test fix + review fixes
This commit is contained in:
Igor Chevdar
2017-03-14 13:06:40 +03:00
parent d58d75c6ef
commit 10ea2883f7
4 changed files with 20 additions and 19 deletions
@@ -772,7 +772,7 @@ class DoubleColonExpressionResolver(
val setter = descriptor.setter
setter == null || Visibilities.isVisible(receiverType?.let(::TransientReceiver), setter, scopeOwnerDescriptor)
}
reflectionTypes.getKPropertyType(Annotations.EMPTY, receiverType, descriptor.type, mutable)
reflectionTypes.getKPropertyType(Annotations.EMPTY, listOfNotNull(receiverType), descriptor.type, mutable)
}
is VariableDescriptor -> null
else -> throw UnsupportedOperationException("Callable reference resolved to an unsupported descriptor: $descriptor")