don't pivot on never or object

This commit is contained in:
Douglas Creager 2025-12-07 14:38:19 -05:00
parent db3501bac1
commit 7fe09c28c4
1 changed files with 18 additions and 0 deletions

View File

@ -2697,6 +2697,24 @@ impl<'db> SequentMap<'db> {
(bound_constraint.lower(db), constrained_upper) (bound_constraint.lower(db), constrained_upper)
} }
// (CL ≤ C ≤ pivot) ∧ (pivot ≤ B ≤ BU) → (CL ≤ C ≤ B)
(constrained_lower, constrained_upper)
if constrained_upper == bound_constraint.lower(db)
&& !constrained_upper.is_never()
&& !constrained_upper.is_object() =>
{
(constrained_lower, Type::TypeVar(bound_typevar))
}
// (pivot ≤ C ≤ CU) ∧ (BL ≤ B ≤ pivot) → (B ≤ C ≤ CU)
(constrained_lower, constrained_upper)
if constrained_lower == bound_constraint.upper(db)
&& !constrained_lower.is_never()
&& !constrained_lower.is_object() =>
{
(Type::TypeVar(bound_typevar), constrained_upper)
}
_ => return, _ => return,
}; };