check all upper bounds even if there are some error types in bounds

for cases like 'val l:List<Int> = id(newList())'
List<???> is a lower bound for id's type parameter here
This commit is contained in:
Svetlana Isakova
2013-07-25 16:37:14 +04:00
parent eb1c29b507
commit 9938c58354
@@ -64,14 +64,12 @@ public class ConstraintsUtil {
} }
addToValuesIfDifferent(superTypeOfLowerBounds, values); addToValuesIfDifferent(superTypeOfLowerBounds, values);
if (values.isEmpty()) {
Collection<JetType> upperBounds = typeConstraintsWithoutErrorTypes.getUpperBounds(); Collection<JetType> upperBounds = typeConstraintsWithoutErrorTypes.getUpperBounds();
for (JetType upperBound : upperBounds) { for (JetType upperBound : upperBounds) {
if (trySuggestion(upperBound, typeConstraints)) { if (trySuggestion(upperBound, typeConstraints)) {
return Collections.singleton(upperBound); return Collections.singleton(upperBound);
} }
} }
}
//todo //todo
//fun <T> foo(t: T, consumer: Consumer<T>): T //fun <T> foo(t: T, consumer: Consumer<T>): T
//foo(1, c: Consumer<Any>) - infer Int, not Any here //foo(1, c: Consumer<Any>) - infer Int, not Any here