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:
+2
-2
@@ -55,7 +55,7 @@ fun test6(a: A) {
|
||||
fun <T, R: T> emptyStrangeMap4(l: MutableList<T>): Map<T, R> = throw Exception("$l")
|
||||
|
||||
fun test7(list: MutableList<Int>) {
|
||||
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>emptyStrangeMap4<!>(list)
|
||||
emptyStrangeMap4(list)
|
||||
}
|
||||
|
||||
//--------------
|
||||
@@ -66,4 +66,4 @@ fun test7() : Map<A, A> = emptyStrangeMap()
|
||||
|
||||
fun <U, V: U> foo(): U = throw Exception()
|
||||
|
||||
fun test8(): Int = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>()
|
||||
fun test8(): Int = foo()
|
||||
|
||||
+11
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user