Minor. Have to deal with error descriptors like previous resolution does.

This commit is contained in:
Stanislav Erokhin
2015-12-04 16:02:58 +03:00
parent 1e0b133e19
commit f2e60a0e11
2 changed files with 12 additions and 9 deletions
@@ -93,7 +93,7 @@ class InnerClassViaStaticReference(val classDescriptor: ClassDescriptor): Resolu
class UnsupportedInnerClassCall(val message: String): ResolutionDiagnostic(ResolutionCandidateApplicability.IMPOSSIBLE_TO_GENERATE) class UnsupportedInnerClassCall(val message: String): ResolutionDiagnostic(ResolutionCandidateApplicability.IMPOSSIBLE_TO_GENERATE)
class UsedSmartCastForDispatchReceiver(val smartCastType: KotlinType): ResolutionDiagnostic(ResolutionCandidateApplicability.RESOLVED) 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 SynthesizedDescriptorDiagnostic: ResolutionDiagnostic(ResolutionCandidateApplicability.RESOLVED_SYNTHESIZED)
object DynamicDescriptorDiagnostic: ResolutionDiagnostic(ResolutionCandidateApplicability.RESOLVED_SYNTHESIZED) object DynamicDescriptorDiagnostic: ResolutionDiagnostic(ResolutionCandidateApplicability.RESOLVED_SYNTHESIZED)
object UnstableSmartCastDiagnostic: ResolutionDiagnostic(ResolutionCandidateApplicability.MAY_THROW_RUNTIME_ERROR) object UnstableSmartCastDiagnostic: ResolutionDiagnostic(ResolutionCandidateApplicability.MAY_THROW_RUNTIME_ERROR)
@@ -47,15 +47,18 @@ internal abstract class AbstractScopeTowerLevel(
val diagnostics = SmartList<ResolutionDiagnostic>() val diagnostics = SmartList<ResolutionDiagnostic>()
diagnostics.addIfNotNull(specialError) diagnostics.addIfNotNull(specialError)
if (ErrorUtils.isError(descriptor)) diagnostics.add(ErrorDescriptorDiagnostic) if (ErrorUtils.isError(descriptor)) {
if (descriptor.isSynthesized) diagnostics.add(SynthesizedDescriptorDiagnostic) diagnostics.add(ErrorDescriptorDiagnostic)
if (dispatchReceiverSmartCastType != null) diagnostics.add(UsedSmartCastForDispatchReceiver(dispatchReceiverSmartCastType)) }
else {
Visibilities.findInvisibleMember( if (descriptor.isSynthesized) diagnostics.add(SynthesizedDescriptorDiagnostic)
dispatchReceiver ?: ReceiverValue.NO_RECEIVER, descriptor, if (dispatchReceiverSmartCastType != null) diagnostics.add(UsedSmartCastForDispatchReceiver(dispatchReceiverSmartCastType))
scopeTower.lexicalScope.ownerDescriptor
)?.let { diagnostics.add(VisibilityError(it)) }
Visibilities.findInvisibleMember(
dispatchReceiver ?: ReceiverValue.NO_RECEIVER, descriptor,
scopeTower.lexicalScope.ownerDescriptor
)?.let { diagnostics.add(VisibilityError(it)) }
}
return CandidateWithBoundDispatchReceiverImpl(dispatchReceiver, descriptor, diagnostics) return CandidateWithBoundDispatchReceiverImpl(dispatchReceiver, descriptor, diagnostics)
} }