refactoring: changed the order of the parameters

This commit is contained in:
Svetlana Isakova
2013-01-18 14:17:01 +04:00
parent da4f1aec1d
commit 677bc55056
4 changed files with 8 additions and 8 deletions
@@ -220,7 +220,7 @@ public class CandidateResolver {
}
ConstraintSystem constraintSystemWithoutExpectedTypeConstraint = constraintSystem.copy();
constraintSystem.addSupertypeConstraint(descriptor.getReturnType(), context.expectedType,
constraintSystem.addSupertypeConstraint(context.expectedType, descriptor.getReturnType(),
ConstraintPosition.EXPECTED_TYPE_POSITION);
@@ -303,7 +303,7 @@ public class CandidateResolver {
context.candidateCall.isSafeCall()
? TypeUtils.makeNotNullable(receiverArgument.getType())
: receiverArgument.getType();
constraintSystem.addSubtypeConstraint(receiverParameter.getType(), receiverType, ConstraintPosition.RECEIVER_POSITION);
constraintSystem.addSubtypeConstraint(receiverType, receiverParameter.getType(), ConstraintPosition.RECEIVER_POSITION);
}
ConstraintSystem
@@ -355,7 +355,7 @@ public class CandidateResolver {
JetType expectedType = substitutor.substitute(effectiveExpectedType, Variance.INVARIANT);
JetType type = argumentTypeResolver.getArgumentTypeInfo(argumentExpression, traceForUnknown, context.scope, context.dataFlowInfo,
expectedType != null ? expectedType : NO_EXPECTED_TYPE, resolveFunctionArgumentBodies).getType();
constraintSystem.addSubtypeConstraint(effectiveExpectedType, type, ConstraintPosition.getValueParameterPosition(
constraintSystem.addSubtypeConstraint(type, effectiveExpectedType, ConstraintPosition.getValueParameterPosition(
valueParameterDescriptor.getIndex()));
if (isErrorType != null) {
isErrorType[0] = type == null || ErrorUtils.isErrorType(type);
@@ -45,7 +45,7 @@ public interface ConstraintSystem {
* For example, for {@code "fun <T> id(t: T) {}"} to infer <tt>T</tt> in invocation <tt>"id(1)"</tt>
* should be generated a constraint <tt>"Int is a subtype of T"</tt> where T is a subject type, and Int is a constraining type.
*/
void addSubtypeConstraint(@NotNull JetType subjectType, @Nullable JetType constrainingType, @NotNull ConstraintPosition constraintPosition);
void addSubtypeConstraint(@Nullable JetType constrainingType, @NotNull JetType subjectType, @NotNull ConstraintPosition constraintPosition);
/**
* Adds a constraint that the constraining type is a supertype of the subject type. <p/>
@@ -54,7 +54,7 @@ public interface ConstraintSystem {
* For example, for {@code "fun <T> create() : T"} to infer <tt>T</tt> in invocation <tt>"val i: Int = create()"</tt>
* should be generated a constraint <tt>"Int is a supertype of T"</tt> where T is a subject type, and Int is a constraining type.
*/
void addSupertypeConstraint(@NotNull JetType subjectType, @Nullable JetType constrainingType, @NotNull ConstraintPosition constraintPosition);
void addSupertypeConstraint(@Nullable JetType constrainingType, @NotNull JetType subjectType, @NotNull ConstraintPosition constraintPosition);
/**
* Returns <tt>true</tt> if constraint system has a solution (has no contradiction and has enough information to infer each registered type variable).
@@ -140,8 +140,8 @@ public class ConstraintSystemImpl implements ConstraintSystem {
@Override
public void addSupertypeConstraint(
@NotNull JetType subjectType,
@Nullable JetType constrainingType,
@NotNull JetType subjectType,
@NotNull ConstraintPosition constraintPosition
) {
addConstraint(SUPER_TYPE, subjectType, constrainingType, constraintPosition);
@@ -149,8 +149,8 @@ public class ConstraintSystemImpl implements ConstraintSystem {
@Override
public void addSubtypeConstraint(
@NotNull JetType subjectType,
@Nullable JetType constrainingType,
@NotNull JetType subjectType,
@NotNull ConstraintPosition constraintPosition
) {
addConstraint(SUB_TYPE, subjectType, constrainingType, constraintPosition);
@@ -250,7 +250,7 @@ public class ExpressionTypingUtils {
}
}
constraintSystem.addSubtypeConstraint(receiverParameter.getType(), receiverType, ConstraintPosition.RECEIVER_POSITION);
constraintSystem.addSubtypeConstraint(receiverType, receiverParameter.getType(), ConstraintPosition.RECEIVER_POSITION);
return constraintSystem.isSuccessful() && ConstraintsUtil.checkBoundsAreSatisfied(constraintSystem);
}