in case of error set all arguments as unmapped

(not to forget to complete them later)
This commit is contained in:
svtk
2013-11-01 13:24:49 +04:00
parent 8c97beecb4
commit 9023e96a07
3 changed files with 12 additions and 4 deletions
@@ -78,12 +78,13 @@ public class CandidateResolver {
if (ErrorUtils.isError(candidate)) {
candidateCall.addStatus(SUCCESS);
argumentTypeResolver.checkTypesWithNoCallee(context.toBasic());
markAllArgumentsAsUnmapped(context);
return;
}
if (!checkOuterClassMemberIsAccessible(context)) {
candidateCall.addStatus(OTHER_ERROR);
markAllArgumentsAsUnmapped(context);
return;
}
@@ -93,6 +94,7 @@ public class CandidateResolver {
if (invisibleMember != null) {
candidateCall.addStatus(OTHER_ERROR);
context.tracing.invisibleMember(context.trace, invisibleMember);
markAllArgumentsAsUnmapped(context);
return;
}
@@ -108,12 +110,11 @@ public class CandidateResolver {
else {
candidateCall.addStatus(OTHER_ERROR);
}
candidateCall.setUnmappedArguments(unmappedArguments);
if ((argumentMappingStatus == ValueArgumentsToParametersMapper.Status.ERROR && candidate.getTypeParameters().isEmpty()) ||
argumentMappingStatus == ValueArgumentsToParametersMapper.Status.STRONG_ERROR) {
argumentTypeResolver.checkTypesWithNoCallee(context.toBasic());
return;
}
candidateCall.setUnmappedArguments(unmappedArguments);
}
}
@@ -171,6 +172,12 @@ public class CandidateResolver {
AutoCastUtils.recordAutoCastIfNecessary(candidateCall.getThisObject(), candidateCall.getTrace());
}
private static void markAllArgumentsAsUnmapped(CallCandidateResolutionContext<?> context) {
if (context.checkArguments == CheckValueArgumentsMode.ENABLED) {
context.candidateCall.setUnmappedArguments(context.call.getValueArguments());
}
}
private static boolean checkOuterClassMemberIsAccessible(@NotNull CallCandidateResolutionContext<?> context) {
// In "this@Outer.foo()" the error will be reported on "this@Outer" instead
if (context.call.getExplicitReceiver().exists() || context.call.getThisObject().exists()) return true;
@@ -176,6 +176,7 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
) {
report(MIXING_NAMED_AND_POSITIONED_ARGUMENTS.on(argument.asElement()));
setStatus(WEAK_ERROR);
unmappedArguments.add(argument);
return positionedThenNamed;
}
@@ -195,7 +195,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements ResolvedC
valueArguments.put(valueParameter, valueArgument);
}
public void setUnmappedArguments(@NotNull Collection<ValueArgument> unmappedArguments) {
public void setUnmappedArguments(@NotNull Collection<? extends ValueArgument> unmappedArguments) {
this.unmappedArguments.addAll(unmappedArguments);
}