[NI] Update filtering of constraints with equal types

Make check for synthetic nullability constraint status before skipping
new constraint with nonunique type.
This commit is contained in:
Pavel Kirpichenkov
2020-01-15 17:01:44 +03:00
parent 2896642f94
commit 0d393e3fd7
4 changed files with 29 additions and 12 deletions
@@ -49,7 +49,11 @@ class MutableVariableWithConstraints(
// return new actual constraint, if this constraint is new
fun addConstraint(constraint: Constraint): Constraint? {
val previousConstraintWithSameType = constraints.filter { it.typeHashCode == constraint.typeHashCode && it.type == constraint.type }
val previousConstraintWithSameType = constraints.filter { oldConstraint ->
oldConstraint.typeHashCode == constraint.typeHashCode
&& oldConstraint.type == constraint.type
&& oldConstraint.isNullabilityConstraint == constraint.isNullabilityConstraint
}
if (previousConstraintWithSameType.any { previous -> newConstraintIsUseless(previous, constraint) })
return null