refactoring

no return from 'inferTypeArguments'
This commit is contained in:
Svetlana Isakova
2012-10-23 15:53:41 +04:00
parent 1f9d08861d
commit a0a4871bff
@@ -363,9 +363,9 @@ public class CallResolver {
ConstraintSystem systemWithCurrentSubstitution = constraintSystem.copy(); ConstraintSystem systemWithCurrentSubstitution = constraintSystem.copy();
addConstraintForValueArgument(valueArgument, valueParameterDescriptor, constraintSystem.getCurrentSubstitutor(), addConstraintForValueArgument(valueArgument, valueParameterDescriptor, constraintSystem.getCurrentSubstitutor(),
systemWithCurrentSubstitution, context); systemWithCurrentSubstitution, context, null);
if (systemWithCurrentSubstitution.hasContradiction() || systemWithCurrentSubstitution.hasErrorInConstrainingTypes()) { if (systemWithCurrentSubstitution.hasContradiction() || systemWithCurrentSubstitution.hasErrorInConstrainingTypes()) {
addConstraintForValueArgument(valueArgument, valueParameterDescriptor, substituteDontCare, constraintSystem, context); addConstraintForValueArgument(valueArgument, valueParameterDescriptor, substituteDontCare, constraintSystem, context, null);
} }
else { else {
constraintSystem = systemWithCurrentSubstitution; constraintSystem = systemWithCurrentSubstitution;
@@ -747,9 +747,10 @@ public class CallResolver {
// Here we type check expecting an error type (DONT_CARE, substitution with substituteDontCare) // Here we type check expecting an error type (DONT_CARE, substitution with substituteDontCare)
// and throw the results away // and throw the results away
// We'll type check the arguments later, with the inferred types expected // We'll type check the arguments later, with the inferred types expected
boolean success = addConstraintForValueArgument(valueArgument, valueParameterDescriptor, substituteDontCare, boolean[] isErrorType = new boolean[1];
constraintsSystem, context); addConstraintForValueArgument(valueArgument, valueParameterDescriptor, substituteDontCare, constraintsSystem,
if (!success) { context, isErrorType);
if (isErrorType[0]) {
candidateCall.argumentHasNoType(); candidateCall.argumentHasNoType();
} }
} }
@@ -800,7 +801,8 @@ public class CallResolver {
@NotNull ValueParameterDescriptor valueParameterDescriptor, @NotNull ValueParameterDescriptor valueParameterDescriptor,
@NotNull TypeSubstitutor substitutor, @NotNull TypeSubstitutor substitutor,
@NotNull ConstraintSystem constraintSystem, @NotNull ConstraintSystem constraintSystem,
@NotNull ResolutionContext context) { @NotNull ResolutionContext context,
@Nullable boolean[] isErrorType) {
JetType effectiveExpectedType = getEffectiveExpectedType(valueParameterDescriptor, valueArgument); JetType effectiveExpectedType = getEffectiveExpectedType(valueParameterDescriptor, valueArgument);
JetExpression argumentExpression = valueArgument.getArgumentExpression(); JetExpression argumentExpression = valueArgument.getArgumentExpression();
@@ -817,6 +819,9 @@ public class CallResolver {
constraintSystem.addSupertypeConstraint(effectiveExpectedType, type, ConstraintPosition.getValueParameterPosition( constraintSystem.addSupertypeConstraint(effectiveExpectedType, type, ConstraintPosition.getValueParameterPosition(
valueParameterDescriptor.getIndex())); valueParameterDescriptor.getIndex()));
//todo no return //todo no return
if (isErrorType != null) {
isErrorType[0] = type == null || ErrorUtils.isErrorType(type);
}
if (type == null || ErrorUtils.isErrorType(type)) return false; if (type == null || ErrorUtils.isErrorType(type)) return false;
return true; return true;
} }