Fixed nested class in companion object case

This commit is contained in:
Valentin Kipyatkov
2017-09-20 12:14:27 +03:00
parent 28e2683146
commit c63eb18b3c
5 changed files with 26 additions and 2 deletions
@@ -548,9 +548,10 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
when (targetDescriptor) {
is ClassDescriptor -> {
if (targetDescriptor.kind != ClassKind.OBJECT) return true
// for object receiver we should additionally check that it's dispatch receiver (that is the member is inside the object)
// for object receiver we should additionally check that it's dispatch receiver (that is the member is inside the object) or not a receiver at all
val resolvedCall = element.getResolvedCall(bindingContext) ?: return false
return resolvedCall.explicitReceiverKind == ExplicitReceiverKind.DISPATCH_RECEIVER
val receiverKind = resolvedCall.explicitReceiverKind
return receiverKind == ExplicitReceiverKind.DISPATCH_RECEIVER || receiverKind == ExplicitReceiverKind.NO_EXPLICIT_RECEIVER
}
is PackageViewDescriptor -> return true