From a0a4871bff3863e90890dc7d3d45fa1afbfa7542 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Tue, 23 Oct 2012 15:53:41 +0400 Subject: [PATCH] refactoring no return from 'inferTypeArguments' --- .../jet/lang/resolve/calls/CallResolver.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java index 86b39d5afe8..d09e85d2925 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java @@ -363,9 +363,9 @@ public class CallResolver { ConstraintSystem systemWithCurrentSubstitution = constraintSystem.copy(); addConstraintForValueArgument(valueArgument, valueParameterDescriptor, constraintSystem.getCurrentSubstitutor(), - systemWithCurrentSubstitution, context); + systemWithCurrentSubstitution, context, null); if (systemWithCurrentSubstitution.hasContradiction() || systemWithCurrentSubstitution.hasErrorInConstrainingTypes()) { - addConstraintForValueArgument(valueArgument, valueParameterDescriptor, substituteDontCare, constraintSystem, context); + addConstraintForValueArgument(valueArgument, valueParameterDescriptor, substituteDontCare, constraintSystem, context, null); } else { constraintSystem = systemWithCurrentSubstitution; @@ -747,9 +747,10 @@ public class CallResolver { // Here we type check expecting an error type (DONT_CARE, substitution with substituteDontCare) // and throw the results away // We'll type check the arguments later, with the inferred types expected - boolean success = addConstraintForValueArgument(valueArgument, valueParameterDescriptor, substituteDontCare, - constraintsSystem, context); - if (!success) { + boolean[] isErrorType = new boolean[1]; + addConstraintForValueArgument(valueArgument, valueParameterDescriptor, substituteDontCare, constraintsSystem, + context, isErrorType); + if (isErrorType[0]) { candidateCall.argumentHasNoType(); } } @@ -800,7 +801,8 @@ public class CallResolver { @NotNull ValueParameterDescriptor valueParameterDescriptor, @NotNull TypeSubstitutor substitutor, @NotNull ConstraintSystem constraintSystem, - @NotNull ResolutionContext context) { + @NotNull ResolutionContext context, + @Nullable boolean[] isErrorType) { JetType effectiveExpectedType = getEffectiveExpectedType(valueParameterDescriptor, valueArgument); JetExpression argumentExpression = valueArgument.getArgumentExpression(); @@ -817,6 +819,9 @@ public class CallResolver { constraintSystem.addSupertypeConstraint(effectiveExpectedType, type, ConstraintPosition.getValueParameterPosition( valueParameterDescriptor.getIndex())); //todo no return + if (isErrorType != null) { + isErrorType[0] = type == null || ErrorUtils.isErrorType(type); + } if (type == null || ErrorUtils.isErrorType(type)) return false; return true; }