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))
|
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) {
|
if (componentType == null) {
|
||||||
componentType = ErrorUtils.createErrorType("$componentName() return type")
|
componentType = ErrorUtils.createErrorType("$componentName() return type")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,14 +100,27 @@ class FakeCallResolver(
|
|||||||
!isFakeKey
|
!isFakeKey
|
||||||
}, true)
|
}, true)
|
||||||
}
|
}
|
||||||
if (hasUnreportedError && reportErrorsOn != null) {
|
|
||||||
when (callKind) {
|
val resolutionResults = result.second
|
||||||
FakeCallKind.ITERATOR -> context.trace.report(Errors.ITERATOR_MISSING.on(reportErrorsOn))
|
if ((!resolutionResults.isSuccess || hasUnreportedError) && reportErrorsOn != null) {
|
||||||
FakeCallKind.COMPONENT ->
|
val diagnostic = when (callKind) {
|
||||||
if (receiver != null) {
|
FakeCallKind.ITERATOR ->
|
||||||
context.trace.report(Errors.COMPONENT_FUNCTION_MISSING.on(reportErrorsOn, name, receiver.type))
|
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
|
return result
|
||||||
|
|||||||
-8
@@ -90,14 +90,6 @@ public class ForLoopConventionsChecker {
|
|||||||
NEXT_AMBIGUITY, NEXT_MISSING, NEXT_NONE_APPLICABLE,
|
NEXT_AMBIGUITY, NEXT_MISSING, NEXT_NONE_APPLICABLE,
|
||||||
LOOP_RANGE_NEXT_RESOLVED_CALL);
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user