mirror of https://github.com/astral-sh/ruff
don't pivot on never or object
This commit is contained in:
parent
db3501bac1
commit
7fe09c28c4
|
|
@ -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,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue