Optimize ConstraintSystemBuilderImpl::generateNewBound
Do not process the bound if it's just the same This situation can actually happen in case of adding bound containing type variable itself
This commit is contained in:
+2
-1
@@ -82,6 +82,7 @@ private fun ConstraintSystemBuilderImpl.addConstraintFromBounds(old: Bound, new:
|
||||
}
|
||||
|
||||
private fun ConstraintSystemBuilderImpl.generateNewBound(bound: Bound, substitution: Bound) {
|
||||
if (bound === substitution) return
|
||||
// Let's have a bound 'T <=> My<R>', and a substitution 'R <=> Type'.
|
||||
// Here <=> means lower_bound, upper_bound or exact_bound constraint.
|
||||
// Then a new bound 'T <=> My<_/in/out Type>' can be generated.
|
||||
@@ -127,4 +128,4 @@ private fun ConstraintSystemBuilderImpl.generateNewBound(bound: Bound, substitut
|
||||
if (approximationBounds.lower.containsConstrainingTypeWithoutProjection() && bound.kind != UPPER_BOUND) {
|
||||
addNewBound(approximationBounds.lower, LOWER_BOUND)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user