From 677bc55056155458b56ee20b6decbd1879744d63 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Fri, 18 Jan 2013 14:17:01 +0400 Subject: [PATCH] refactoring: changed the order of the parameters --- .../jetbrains/jet/lang/resolve/calls/CandidateResolver.java | 6 +++--- .../jet/lang/resolve/calls/inference/ConstraintSystem.java | 4 ++-- .../lang/resolve/calls/inference/ConstraintSystemImpl.java | 4 ++-- .../jet/lang/types/expressions/ExpressionTypingUtils.java | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java index 75880a1c6cc..23eaad5c1de 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CandidateResolver.java @@ -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); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystem.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystem.java index edaee154bd1..53de91d5d31 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystem.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystem.java @@ -45,7 +45,7 @@ public interface ConstraintSystem { * For example, for {@code "fun id(t: T) {}"} to infer T in invocation "id(1)" * should be generated a constraint "Int is a subtype of T" 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.

@@ -54,7 +54,7 @@ public interface ConstraintSystem { * For example, for {@code "fun create() : T"} to infer T in invocation "val i: Int = create()" * should be generated a constraint "Int is a supertype of T" 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 true if constraint system has a solution (has no contradiction and has enough information to infer each registered type variable). diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystemImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystemImpl.java index 0dffc39b423..8b01ae71806 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystemImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystemImpl.java @@ -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); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingUtils.java index ad2afe3b775..69fd2943e9e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingUtils.java @@ -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); }