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)) { if (ErrorUtils.isError(candidate)) {
candidateCall.addStatus(SUCCESS); candidateCall.addStatus(SUCCESS);
argumentTypeResolver.checkTypesWithNoCallee(context.toBasic()); markAllArgumentsAsUnmapped(context);
return; return;
} }
if (!checkOuterClassMemberIsAccessible(context)) { if (!checkOuterClassMemberIsAccessible(context)) {
candidateCall.addStatus(OTHER_ERROR); candidateCall.addStatus(OTHER_ERROR);
markAllArgumentsAsUnmapped(context);
return; return;
} }
@@ -93,6 +94,7 @@ public class CandidateResolver {
if (invisibleMember != null) { if (invisibleMember != null) {
candidateCall.addStatus(OTHER_ERROR); candidateCall.addStatus(OTHER_ERROR);
context.tracing.invisibleMember(context.trace, invisibleMember); context.tracing.invisibleMember(context.trace, invisibleMember);
markAllArgumentsAsUnmapped(context);
return; return;
} }
@@ -108,12 +110,11 @@ public class CandidateResolver {
else { else {
candidateCall.addStatus(OTHER_ERROR); candidateCall.addStatus(OTHER_ERROR);
} }
candidateCall.setUnmappedArguments(unmappedArguments);
if ((argumentMappingStatus == ValueArgumentsToParametersMapper.Status.ERROR && candidate.getTypeParameters().isEmpty()) || if ((argumentMappingStatus == ValueArgumentsToParametersMapper.Status.ERROR && candidate.getTypeParameters().isEmpty()) ||
argumentMappingStatus == ValueArgumentsToParametersMapper.Status.STRONG_ERROR) { argumentMappingStatus == ValueArgumentsToParametersMapper.Status.STRONG_ERROR) {
argumentTypeResolver.checkTypesWithNoCallee(context.toBasic());
return; return;
} }
candidateCall.setUnmappedArguments(unmappedArguments);
} }
} }
@@ -171,6 +172,12 @@ public class CandidateResolver {
AutoCastUtils.recordAutoCastIfNecessary(candidateCall.getThisObject(), candidateCall.getTrace()); 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) { private static boolean checkOuterClassMemberIsAccessible(@NotNull CallCandidateResolutionContext<?> context) {
// In "this@Outer.foo()" the error will be reported on "this@Outer" instead // In "this@Outer.foo()" the error will be reported on "this@Outer" instead
if (context.call.getExplicitReceiver().exists() || context.call.getThisObject().exists()) return true; 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())); report(MIXING_NAMED_AND_POSITIONED_ARGUMENTS.on(argument.asElement()));
setStatus(WEAK_ERROR); setStatus(WEAK_ERROR);
unmappedArguments.add(argument);
return positionedThenNamed; return positionedThenNamed;
} }
@@ -195,7 +195,7 @@ public class ResolvedCallImpl<D extends CallableDescriptor> implements ResolvedC
valueArguments.put(valueParameter, valueArgument); valueArguments.put(valueParameter, valueArgument);
} }
public void setUnmappedArguments(@NotNull Collection<ValueArgument> unmappedArguments) { public void setUnmappedArguments(@NotNull Collection<? extends ValueArgument> unmappedArguments) {
this.unmappedArguments.addAll(unmappedArguments); this.unmappedArguments.addAll(unmappedArguments);
} }