NI: Fix callable references resolution when LHS is generic nested class
In case of null qualifier, we should not look into any static scope NB: factory::createCallableProcessor returns NoExplicitReceiver processor in case of null-receiver, that makes resolving the call in the test as `property(::key)` that matches to the property itself, thus leading to overload resolution ambiguity ^KT-35887 Fixed
This commit is contained in:
+6
-2
@@ -85,11 +85,15 @@ fun createCallableReferenceProcessor(factory: CallableReferencesCandidateFactory
|
||||
return factory.createCallableProcessor(explicitReceiver)
|
||||
}
|
||||
is LHSResult.Type -> {
|
||||
val static = factory.createCallableProcessor(lhsResult.qualifier)
|
||||
val static = lhsResult.qualifier?.let(factory::createCallableProcessor)
|
||||
val unbound = factory.createCallableProcessor(lhsResult.unboundDetailedReceiver)
|
||||
|
||||
// note that if we use PrioritizedCompositeScopeTowerProcessor then static will win over unbound members
|
||||
val staticOrUnbound = SamePriorityCompositeScopeTowerProcessor(static, unbound)
|
||||
val staticOrUnbound =
|
||||
if (static != null)
|
||||
SamePriorityCompositeScopeTowerProcessor(static, unbound)
|
||||
else
|
||||
unbound
|
||||
|
||||
val asValue = lhsResult.qualifier?.classValueReceiverWithSmartCastInfo ?: return staticOrUnbound
|
||||
return PrioritizedCompositeScopeTowerProcessor(staticOrUnbound, factory.createCallableProcessor(asValue))
|
||||
|
||||
Reference in New Issue
Block a user