Minor refactoring in frontend/resolution
Fix typos, formatting, diagnostic message
This commit is contained in:
+4
-6
@@ -261,21 +261,19 @@ class NewResolutionOldInference(
|
|||||||
): Boolean {
|
): Boolean {
|
||||||
val reference = context.call.calleeExpression as? KtReferenceExpression ?: return false
|
val reference = context.call.calleeExpression as? KtReferenceExpression ?: return false
|
||||||
|
|
||||||
val errorCadidates = when (kind) {
|
val errorCandidates = when (kind) {
|
||||||
ResolutionKind.Function -> collectErrorCandidatesForFunction(scopeTower, name, detailedReceiver)
|
ResolutionKind.Function -> collectErrorCandidatesForFunction(scopeTower, name, detailedReceiver)
|
||||||
ResolutionKind.Variable -> collectErrorCandidatesForVariable(scopeTower, name, detailedReceiver)
|
ResolutionKind.Variable -> collectErrorCandidatesForVariable(scopeTower, name, detailedReceiver)
|
||||||
else -> emptyList()
|
else -> emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
for (candidate in errorCadidates) {
|
val candidate = errorCandidates.firstOrNull() as? ErrorCandidate.Classifier ?: return false
|
||||||
if (candidate is ErrorCandidate.Classifier) {
|
|
||||||
context.trace.record(BindingContext.REFERENCE_TARGET, reference, candidate.descriptor)
|
context.trace.record(BindingContext.REFERENCE_TARGET, reference, candidate.descriptor)
|
||||||
context.trace.report(Errors.RESOLUTION_TO_CLASSIFIER.on(reference, candidate.descriptor, candidate.kind, candidate.errorMessage))
|
context.trace.report(Errors.RESOLUTION_TO_CLASSIFIER.on(reference, candidate.descriptor, candidate.kind, candidate.errorMessage))
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ImplicitScopeTowerImpl(
|
private class ImplicitScopeTowerImpl(
|
||||||
val resolutionContext: ResolutionContext<*>,
|
val resolutionContext: ResolutionContext<*>,
|
||||||
|
|||||||
+4
-2
@@ -35,8 +35,10 @@ enum class WrongResolutionToClassifier(val message: (Name) -> String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sealed class ErrorCandidate<out D: DeclarationDescriptor>(val descriptor: D) {
|
sealed class ErrorCandidate<out D: DeclarationDescriptor>(val descriptor: D) {
|
||||||
class Classifier(classifierDescriptor: ClassifierDescriptor, val kind: WrongResolutionToClassifier)
|
class Classifier(
|
||||||
: ErrorCandidate<ClassifierDescriptor>(classifierDescriptor) {
|
classifierDescriptor: ClassifierDescriptor,
|
||||||
|
val kind: WrongResolutionToClassifier
|
||||||
|
) : ErrorCandidate<ClassifierDescriptor>(classifierDescriptor) {
|
||||||
val errorMessage = kind.message(descriptor.name)
|
val errorMessage = kind.message(descriptor.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user