NI: Add constraints which contain constraining type without projection
^KT-32243 Fixed ^KT-35172 Fixed
This commit is contained in:
committed by
victor.petukhov
parent
65cc0fa463
commit
775eb67219
-10
@@ -157,7 +157,6 @@ class ConstraintIncorporator(
|
||||
isSubtype: Boolean
|
||||
) {
|
||||
if (targetVariable in getNestedTypeVariables(newConstraint)) return
|
||||
if (!containsConstrainingTypeWithoutProjection(newConstraint, otherConstraint)) return
|
||||
if (trivialConstraintTypeInferenceOracle.isGeneratedConstraintTrivial(
|
||||
baseConstraint, otherConstraint, newConstraint, isSubtype
|
||||
)
|
||||
@@ -173,15 +172,6 @@ class ConstraintIncorporator(
|
||||
addNewIncorporatedConstraint(targetVariable, newConstraint, ConstraintContext(kind, derivedFrom))
|
||||
}
|
||||
|
||||
fun Context.containsConstrainingTypeWithoutProjection(
|
||||
newConstraint: KotlinTypeMarker,
|
||||
otherConstraint: Constraint
|
||||
): Boolean {
|
||||
return getNestedArguments(newConstraint).any {
|
||||
it.getType().typeConstructor() == otherConstraint.type.typeConstructor() && it.getVariance() == TypeVariance.INV
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.getNestedTypeVariables(type: KotlinTypeMarker): List<TypeVariableMarker> =
|
||||
getNestedArguments(type).mapNotNull { getTypeVariable(it.getType().typeConstructor()) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user