Load special override as HIDDEN in case of signature clash

#KT-10151 Fixed
This commit is contained in:
Denis Zharkov
2015-12-09 14:09:38 +03:00
parent 45c0bc3610
commit 871fe7680b
40 changed files with 445 additions and 51 deletions
@@ -708,7 +708,7 @@ public class CallResolver {
) {
final List<CallCandidateResolutionContext<D>> candidateResolutionContexts = ContainerUtil.newArrayList();
for (final ResolutionCandidate<D> resolutionCandidate : task.getCandidates()) {
if (DeprecationUtilKt.isAnnotatedAsHidden(resolutionCandidate.getDescriptor())) continue;
if (DeprecationUtilKt.isHiddenInResolution(resolutionCandidate.getDescriptor())) continue;
candidatePerfCounter.time(new Function0<Unit>() {
@Override
@@ -42,7 +42,7 @@ import org.jetbrains.kotlin.resolve.calls.tasks.DynamicCallableDescriptors
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategy
import org.jetbrains.kotlin.resolve.calls.tasks.TracingStrategyForInvoke
import org.jetbrains.kotlin.resolve.isAnnotatedAsHidden
import org.jetbrains.kotlin.resolve.isHiddenInResolution
import org.jetbrains.kotlin.resolve.scopes.receivers.*
import org.jetbrains.kotlin.types.DeferredType
import org.jetbrains.kotlin.types.ErrorUtils
@@ -201,7 +201,7 @@ class NewResolveOldInference(
return Candidate(ResolutionCandidateStatus(listOf(ExtensionWithStaticTypeWithDynamicReceiver)), candidateCall)
}
if (towerCandidate.descriptor.isAnnotatedAsHidden()) {
if (towerCandidate.descriptor.isHiddenInResolution()) {
return Candidate(ResolutionCandidateStatus(listOf(HiddenDescriptor)), candidateCall)
}
@@ -97,7 +97,8 @@ fun DeclarationDescriptor.getDeprecatedAnnotationLevel(): DeprecationLevelValue?
@Deprecated("Should be removed together with kotlin.HiddenDeclaration")
private val HIDDEN_ANNOTATION_FQ_NAME = FqName("kotlin.HiddenDeclaration")
fun DeclarationDescriptor.isAnnotatedAsHidden(): Boolean {
fun DeclarationDescriptor.isHiddenInResolution(): Boolean {
if (this is FunctionDescriptor && this.isHiddenToOvercomeSignatureClash) return true
return annotations.findAnnotation(HIDDEN_ANNOTATION_FQ_NAME) != null
|| getDeprecatedAnnotationLevel() == DeprecationLevelValue.HIDDEN
}