rename (swap SUB_TYPE and SUPER_TYPE)

This commit is contained in:
Svetlana Isakova
2012-12-26 14:18:21 +04:00
parent e6594ed5b1
commit 6208bdb6da
2 changed files with 15 additions and 15 deletions
@@ -146,7 +146,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
@Nullable JetType constrainingType, @Nullable JetType constrainingType,
@NotNull ConstraintPosition constraintPosition @NotNull ConstraintPosition constraintPosition
) { ) {
addConstraint(SUB_TYPE, subjectType, constrainingType, constraintPosition); addConstraint(SUPER_TYPE, subjectType, constrainingType, constraintPosition);
} }
@Override @Override
@@ -155,7 +155,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
@Nullable JetType constrainingType, @Nullable JetType constrainingType,
@NotNull ConstraintPosition constraintPosition @NotNull ConstraintPosition constraintPosition
) { ) {
addConstraint(SUPER_TYPE, subjectType, constrainingType, constraintPosition); addConstraint(SUB_TYPE, subjectType, constrainingType, constraintPosition);
} }
private void addConstraint(@NotNull ConstraintKind constraintKind, private void addConstraint(@NotNull ConstraintKind constraintKind,
@@ -209,7 +209,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
return; return;
} }
switch (constraintKind) { switch (constraintKind) {
case SUPER_TYPE: { case SUB_TYPE: {
if (KotlinBuiltIns.getInstance().isNothingOrNullableNothing(constrainingType)) break; if (KotlinBuiltIns.getInstance().isNothingOrNullableNothing(constrainingType)) break;
JetType correspondingSupertype = TypeCheckingProcedure.findCorrespondingSupertype(constrainingType, subjectType); JetType correspondingSupertype = TypeCheckingProcedure.findCorrespondingSupertype(constrainingType, subjectType);
if (correspondingSupertype != null) { if (correspondingSupertype != null) {
@@ -217,7 +217,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
} }
break; break;
} }
case SUB_TYPE: { case SUPER_TYPE: {
if (KotlinBuiltIns.getInstance().isNothingOrNullableNothing(subjectType)) break; if (KotlinBuiltIns.getInstance().isNothingOrNullableNothing(subjectType)) break;
JetType correspondingSupertype = TypeCheckingProcedure.findCorrespondingSupertype(subjectType, constrainingType); JetType correspondingSupertype = TypeCheckingProcedure.findCorrespondingSupertype(subjectType, constrainingType);
if (correspondingSupertype != null) { if (correspondingSupertype != null) {
@@ -283,10 +283,10 @@ public class ConstraintSystemImpl implements ConstraintSystem {
if (typeParameterVariance != INVARIANT) { if (typeParameterVariance != INVARIANT) {
varianceForTypeParameter = typeParameterVariance; varianceForTypeParameter = typeParameterVariance;
} }
else if (upperConstraintKind == SUB_TYPE) { else if (upperConstraintKind == SUPER_TYPE) {
varianceForTypeParameter = constrainingTypeProjection.getProjectionKind(); varianceForTypeParameter = constrainingTypeProjection.getProjectionKind();
} }
else if (upperConstraintKind == SUPER_TYPE) { else if (upperConstraintKind == SUB_TYPE) {
varianceForTypeParameter = subjectTypeProjection.getProjectionKind(); varianceForTypeParameter = subjectTypeProjection.getProjectionKind();
} }
else { else {
@@ -299,11 +299,11 @@ public class ConstraintSystemImpl implements ConstraintSystem {
/** /**
* Let class {@code MyClass<T, out R, in S>} is declared.<br/><br/> * Let class {@code MyClass<T, out R, in S>} is declared.<br/><br/>
* *
* If upperConstraintKind is SUB_TYPE: * If upperConstraintKind is SUPER_TYPE:
* {@code MyClass<A, B, C> <: MyClass<D, E, F>}, <br/> * {@code MyClass<A, B, C> <: MyClass<D, E, F>}, <br/>
* then constraints {@code A = D, B <: E, C >: F} are generated. <br/><br/> * then constraints {@code A = D, B <: E, C >: F} are generated. <br/><br/>
* *
* If upperConstraintKind is SUPER_TYPE: * If upperConstraintKind is SUB_TYPE:
* {@code MyClass<A, B, C> >: MyClass<D, E, F>}, <br/> * {@code MyClass<A, B, C> >: MyClass<D, E, F>}, <br/>
* then constraints {@code A = D, B >: E, C <: F} are generated. <br/><br/> * then constraints {@code A = D, B >: E, C <: F} are generated. <br/><br/>
* *
@@ -322,11 +322,11 @@ public class ConstraintSystemImpl implements ConstraintSystem {
if (upperConstraintKind == EQUAL || typeParameterVariance == INVARIANT) { if (upperConstraintKind == EQUAL || typeParameterVariance == INVARIANT) {
return EQUAL; return EQUAL;
} }
if ((upperConstraintKind == SUPER_TYPE && typeParameterVariance == OUT_VARIANCE) || if ((upperConstraintKind == SUB_TYPE && typeParameterVariance == OUT_VARIANCE) ||
(upperConstraintKind == SUB_TYPE && typeParameterVariance == IN_VARIANCE)) { (upperConstraintKind == SUPER_TYPE && typeParameterVariance == IN_VARIANCE)) {
return SUPER_TYPE; return SUB_TYPE;
} }
return SUB_TYPE; return SUPER_TYPE;
} }
@NotNull @NotNull
@@ -44,10 +44,10 @@ public class TypeConstraintsImpl implements TypeConstraints {
public void addBound(@NotNull ConstraintKind constraintKind, @NotNull JetType type) { public void addBound(@NotNull ConstraintKind constraintKind, @NotNull JetType type) {
switch (constraintKind) { switch (constraintKind) {
case SUPER_TYPE: case SUB_TYPE:
lowerBounds.add(type); lowerBounds.add(type);
break; break;
case SUB_TYPE: case SUPER_TYPE:
upperBounds.add(type); upperBounds.add(type);
break; break;
case EQUAL: case EQUAL:
@@ -93,6 +93,6 @@ public class TypeConstraintsImpl implements TypeConstraints {
} }
public static enum ConstraintKind { public static enum ConstraintKind {
SUB_TYPE, SUPER_TYPE, EQUAL SUPER_TYPE, SUB_TYPE, EQUAL
} }
} }