diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/ScopeTower.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/ScopeTower.kt index 92228300b8f..4e22c916b3a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/ScopeTower.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/ScopeTower.kt @@ -93,7 +93,7 @@ class InnerClassViaStaticReference(val classDescriptor: ClassDescriptor): Resolu class UnsupportedInnerClassCall(val message: String): ResolutionDiagnostic(ResolutionCandidateApplicability.IMPOSSIBLE_TO_GENERATE) class UsedSmartCastForDispatchReceiver(val smartCastType: KotlinType): ResolutionDiagnostic(ResolutionCandidateApplicability.RESOLVED) -object ErrorDescriptorDiagnostic : ResolutionDiagnostic(ResolutionCandidateApplicability.INAPPLICABLE) +object ErrorDescriptorDiagnostic : ResolutionDiagnostic(ResolutionCandidateApplicability.RESOLVED) // todo discuss and change to INAPPLICABLE object SynthesizedDescriptorDiagnostic: ResolutionDiagnostic(ResolutionCandidateApplicability.RESOLVED_SYNTHESIZED) object DynamicDescriptorDiagnostic: ResolutionDiagnostic(ResolutionCandidateApplicability.RESOLVED_SYNTHESIZED) object UnstableSmartCastDiagnostic: ResolutionDiagnostic(ResolutionCandidateApplicability.MAY_THROW_RUNTIME_ERROR) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt index 8df72ea76b7..62ee1fadadb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/TowerLevels.kt @@ -47,15 +47,18 @@ internal abstract class AbstractScopeTowerLevel( val diagnostics = SmartList() diagnostics.addIfNotNull(specialError) - if (ErrorUtils.isError(descriptor)) diagnostics.add(ErrorDescriptorDiagnostic) - if (descriptor.isSynthesized) diagnostics.add(SynthesizedDescriptorDiagnostic) - if (dispatchReceiverSmartCastType != null) diagnostics.add(UsedSmartCastForDispatchReceiver(dispatchReceiverSmartCastType)) - - Visibilities.findInvisibleMember( - dispatchReceiver ?: ReceiverValue.NO_RECEIVER, descriptor, - scopeTower.lexicalScope.ownerDescriptor - )?.let { diagnostics.add(VisibilityError(it)) } + if (ErrorUtils.isError(descriptor)) { + diagnostics.add(ErrorDescriptorDiagnostic) + } + else { + if (descriptor.isSynthesized) diagnostics.add(SynthesizedDescriptorDiagnostic) + if (dispatchReceiverSmartCastType != null) diagnostics.add(UsedSmartCastForDispatchReceiver(dispatchReceiverSmartCastType)) + Visibilities.findInvisibleMember( + dispatchReceiver ?: ReceiverValue.NO_RECEIVER, descriptor, + scopeTower.lexicalScope.ownerDescriptor + )?.let { diagnostics.add(VisibilityError(it)) } + } return CandidateWithBoundDispatchReceiverImpl(dispatchReceiver, descriptor, diagnostics) }