support one more special case of propagating bound constraints

(temporary while there is no common constraint system and its resolution)
This commit is contained in:
Svetlana Isakova
2013-09-26 14:44:22 +04:00
parent cb25e1d55a
commit 8a4afb9330
2 changed files with 13 additions and 2 deletions
@@ -437,6 +437,17 @@ public class ConstraintSystemImpl implements ConstraintSystem {
addSubtypeConstraint(constraint.type, declaredUpperBound, position);
}
}
ClassifierDescriptor declarationDescriptor = declaredUpperBound.getConstructor().getDeclarationDescriptor();
if (declarationDescriptor instanceof TypeParameterDescriptor && typeParameterConstraints.containsKey(declarationDescriptor)) {
TypeConstraintsImpl typeConstraintsForUpperBound = typeParameterConstraints.get(declarationDescriptor);
for (Constraint constraint : typeConstraintsForUpperBound.getConstraints()) {
if (constraint.boundKind == UPPER_BOUND || constraint.boundKind == EXACT_BOUND) {
ConstraintPosition position = ConstraintPosition.getCompoundConstraintPosition(
ConstraintPosition.getTypeBoundPosition(typeParameterDescriptor.getIndex()), constraint.constraintPosition);
typeConstraints.addConstraint(UPPER_BOUND, constraint.type, position);
}
}
}
}
}
}