[NI] Filter out type variable from its dependencies
Don't take into account complex variable dependency on itself when determining fixation status. ^KT-37621 Fixed
This commit is contained in:
+6
-3
@@ -54,8 +54,8 @@ class VariableFixationFinder(
|
||||
enum class TypeVariableFixationReadiness {
|
||||
FORBIDDEN,
|
||||
WITHOUT_PROPER_ARGUMENT_CONSTRAINT, // proper constraint from arguments -- not from upper bound for type parameters
|
||||
WITH_COMPLEX_DEPENDENCY_LOWER, // if type variable T has constraint with non fixed type variable inside (non-top-level): T <: Foo<S>
|
||||
WITH_COMPLEX_DEPENDENCY_UPPER, // Foo<S> <: T
|
||||
WITH_COMPLEX_DEPENDENCY_LOWER, // if type variable T has constraint with non fixed type variable inside (non-top-level): Foo<S> <: T
|
||||
WITH_COMPLEX_DEPENDENCY_UPPER, // T <: Foo<S>
|
||||
WITH_TRIVIAL_OR_NON_PROPER_CONSTRAINTS, // proper trivial constraint from arguments, Nothing <: T
|
||||
RELATED_TO_ANY_OUTPUT_TYPE,
|
||||
READY_FOR_FIXATION,
|
||||
@@ -124,7 +124,10 @@ class VariableFixationFinder(
|
||||
private fun Context.hasDependencyToOtherTypeVariables(typeVariable: TypeConstructorMarker, kind: ConstraintKind): Boolean {
|
||||
for (constraint in notFixedTypeVariables[typeVariable]?.constraints ?: return false) {
|
||||
if (constraint.kind != kind || constraint.kind == ConstraintKind.EQUALITY) continue
|
||||
if (constraint.type.lowerBoundIfFlexible().argumentsCount() != 0 && constraint.type.contains { notFixedTypeVariables.containsKey(it.typeConstructor()) }) {
|
||||
if (constraint.type.lowerBoundIfFlexible().argumentsCount() != 0
|
||||
&& constraint.type.contains {
|
||||
it.typeConstructor() != typeVariable && notFixedTypeVariables.containsKey(it.typeConstructor())
|
||||
}) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user