try intersection of upper bounds as a suggestion

not each bound itself
while resolving constraint system
This commit is contained in:
Svetlana Isakova
2013-09-27 13:53:27 +04:00
parent 8a4afb9330
commit 65e2f47bc3
4 changed files with 57 additions and 3 deletions
@@ -186,9 +186,10 @@ public class TypeConstraintsImpl implements TypeConstraints {
ContainerUtil.addIfNotNull(superTypeOfLowerBounds, values);
Set<JetType> upperBounds = filterBounds(constraints, BoundKind.UPPER_BOUND, values);
for (JetType upperBound : upperBounds) {
if (trySuggestion(upperBound, constraints)) {
return Collections.singleton(upperBound);
JetType intersectionOfUpperBounds = TypeUtils.intersect(JetTypeChecker.INSTANCE, upperBounds);
if (!upperBounds.isEmpty() && intersectionOfUpperBounds != null) {
if (trySuggestion(intersectionOfUpperBounds, constraints)) {
return Collections.singleton(intersectionOfUpperBounds);
}
}
//todo