mirror of https://github.com/astral-sh/ruff
don't pivot on never or object
This commit is contained in:
parent
ecb9c1301b
commit
22c7fc4516
|
|
@ -2655,14 +2655,18 @@ impl<'db> SequentMap<'db> {
|
|||
|
||||
// (CL ≤ C ≤ pivot) ∧ (pivot ≤ B ≤ BU) → (CL ≤ C ≤ B)
|
||||
(constrained_lower, constrained_upper)
|
||||
if constrained_upper == bound_constraint.lower(db) =>
|
||||
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) =>
|
||||
if constrained_lower == bound_constraint.upper(db)
|
||||
&& !constrained_lower.is_never()
|
||||
&& !constrained_lower.is_object() =>
|
||||
{
|
||||
(Type::TypeVar(bound_typevar), constrained_upper)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue