[NI] Write info about hidden descriptor to candidate

This commit is contained in:
Mikhail Zarechenskiy
2017-06-08 16:01:00 +03:00
parent 38d9123a57
commit def0816095
4 changed files with 21 additions and 3 deletions
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.resolve.calls.components
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.resolve.calls.model.*
import org.jetbrains.kotlin.types.UnwrappedType
@@ -40,4 +41,6 @@ interface KotlinResolutionCallbacks {
resultTypeParameters: List<UnwrappedType>)
fun completeCollectionLiteralCalls(collectionLiteralArgument: ResolvedCollectionLiteralArgument)
fun isHiddenInResolution(descriptor: DeclarationDescriptor, isSuperCall: Boolean = false): Boolean
}
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.components.ResultTypeResolve
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
import org.jetbrains.kotlin.resolve.calls.tower.CandidateFactory
import org.jetbrains.kotlin.resolve.calls.tower.CandidateWithBoundDispatchReceiver
import org.jetbrains.kotlin.resolve.calls.tower.HiddenDescriptor
import org.jetbrains.kotlin.resolve.calls.tower.ImplicitScopeTower
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValueWithSmartCastInfo
import org.jetbrains.kotlin.types.ErrorUtils
@@ -75,8 +76,13 @@ class SimpleCandidateFactory(val callContext: KotlinCallContext, val kotlinCall:
return ErrorKotlinResolutionCandidate(callContext, kotlinCall, explicitReceiverKind, dispatchArgumentReceiver, extensionArgumentReceiver, towerCandidate.descriptor)
}
val candidateDiagnostics = towerCandidate.diagnostics.toMutableList()
if (callContext.resolutionCallbacks.isHiddenInResolution(towerCandidate.descriptor, kotlinCall.isSuperOrDelegatingConstructorCall)) {
candidateDiagnostics.add(HiddenDescriptor)
}
return SimpleKotlinResolutionCandidate(callContext, kotlinCall, explicitReceiverKind, dispatchArgumentReceiver, extensionArgumentReceiver,
towerCandidate.descriptor, null, towerCandidate.diagnostics)
towerCandidate.descriptor, null, candidateDiagnostics)
}
}