Rework error reporting for fake call resolution
Move diagnostic creation to one place
This commit is contained in:
-6
@@ -64,12 +64,6 @@ class DestructuringDeclarationResolver(
|
||||
context.trace.report(Errors.COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH.on(reportErrorsOn, componentName, componentType, expectedType))
|
||||
}
|
||||
}
|
||||
else if (results.isAmbiguity) {
|
||||
context.trace.report(Errors.COMPONENT_FUNCTION_AMBIGUITY.on(reportErrorsOn, componentName, results.getResultingCalls()))
|
||||
}
|
||||
else {
|
||||
context.trace.report(Errors.COMPONENT_FUNCTION_MISSING.on(reportErrorsOn, componentName, receiver.getType()))
|
||||
}
|
||||
if (componentType == null) {
|
||||
componentType = ErrorUtils.createErrorType("$componentName() return type")
|
||||
}
|
||||
|
||||
@@ -100,14 +100,27 @@ class FakeCallResolver(
|
||||
!isFakeKey
|
||||
}, true)
|
||||
}
|
||||
if (hasUnreportedError && reportErrorsOn != null) {
|
||||
when (callKind) {
|
||||
FakeCallKind.ITERATOR -> context.trace.report(Errors.ITERATOR_MISSING.on(reportErrorsOn))
|
||||
FakeCallKind.COMPONENT ->
|
||||
if (receiver != null) {
|
||||
context.trace.report(Errors.COMPONENT_FUNCTION_MISSING.on(reportErrorsOn, name, receiver.type))
|
||||
|
||||
val resolutionResults = result.second
|
||||
if ((!resolutionResults.isSuccess || hasUnreportedError) && reportErrorsOn != null) {
|
||||
val diagnostic = when (callKind) {
|
||||
FakeCallKind.ITERATOR ->
|
||||
when {
|
||||
resolutionResults.isAmbiguity -> Errors.ITERATOR_AMBIGUITY.on(reportErrorsOn, resolutionResults.resultingCalls)
|
||||
else -> Errors.ITERATOR_MISSING.on(reportErrorsOn)
|
||||
}
|
||||
FakeCallKind.OTHER -> {}
|
||||
FakeCallKind.COMPONENT ->
|
||||
when {
|
||||
resolutionResults.isAmbiguity -> Errors.COMPONENT_FUNCTION_AMBIGUITY.on(
|
||||
reportErrorsOn, name, resolutionResults.resultingCalls)
|
||||
receiver != null -> Errors.COMPONENT_FUNCTION_MISSING.on(reportErrorsOn, name, receiver.type)
|
||||
else -> null
|
||||
}
|
||||
FakeCallKind.OTHER -> null
|
||||
}
|
||||
|
||||
if (diagnostic != null) {
|
||||
context.trace.report(diagnostic)
|
||||
}
|
||||
}
|
||||
return result
|
||||
|
||||
-8
@@ -90,14 +90,6 @@ public class ForLoopConventionsChecker {
|
||||
NEXT_AMBIGUITY, NEXT_MISSING, NEXT_NONE_APPLICABLE,
|
||||
LOOP_RANGE_NEXT_RESOLVED_CALL);
|
||||
}
|
||||
else {
|
||||
if (iteratorResolutionResults.isAmbiguity()) {
|
||||
context.trace.report(ITERATOR_AMBIGUITY.on(loopRangeExpression, iteratorResolutionResults.getResultingCalls()));
|
||||
}
|
||||
else {
|
||||
context.trace.report(ITERATOR_MISSING.on(loopRangeExpression));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user