mirror of https://github.com/astral-sh/ruff
don't always bump
This commit is contained in:
parent
63c75d85d0
commit
88eb5eba22
|
|
@ -354,7 +354,7 @@ impl<'db> ConstraintSet<'db> {
|
||||||
/// In the result, `self` will appear before `other` according to the `source_order` of the BDD
|
/// In the result, `self` will appear before `other` according to the `source_order` of the BDD
|
||||||
/// nodes.
|
/// nodes.
|
||||||
pub(crate) fn union(&mut self, db: &'db dyn Db, other: Self) -> Self {
|
pub(crate) fn union(&mut self, db: &'db dyn Db, other: Self) -> Self {
|
||||||
self.node = self.node.or(db, other.node);
|
self.node = self.node.or_with_offset(db, other.node);
|
||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -363,7 +363,7 @@ impl<'db> ConstraintSet<'db> {
|
||||||
/// In the result, `self` will appear before `other` according to the `source_order` of the BDD
|
/// In the result, `self` will appear before `other` according to the `source_order` of the BDD
|
||||||
/// nodes.
|
/// nodes.
|
||||||
pub(crate) fn intersect(&mut self, db: &'db dyn Db, other: Self) -> Self {
|
pub(crate) fn intersect(&mut self, db: &'db dyn Db, other: Self) -> Self {
|
||||||
self.node = self.node.and(db, other.node);
|
self.node = self.node.and_with_offset(db, other.node);
|
||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -414,7 +414,7 @@ impl<'db> ConstraintSet<'db> {
|
||||||
/// nodes.
|
/// nodes.
|
||||||
pub(crate) fn iff(self, db: &'db dyn Db, other: Self) -> Self {
|
pub(crate) fn iff(self, db: &'db dyn Db, other: Self) -> Self {
|
||||||
ConstraintSet {
|
ConstraintSet {
|
||||||
node: self.node.iff(db, other.node),
|
node: self.node.iff_with_offset(db, other.node),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1082,13 +1082,17 @@ impl<'db> Node<'db> {
|
||||||
///
|
///
|
||||||
/// In the result, `self` will appear before `other` according to the `source_order` of the BDD
|
/// In the result, `self` will appear before `other` according to the `source_order` of the BDD
|
||||||
/// nodes.
|
/// nodes.
|
||||||
fn or(self, db: &'db dyn Db, other: Self) -> Self {
|
fn or_with_offset(self, db: &'db dyn Db, other: Self) -> Self {
|
||||||
// To ensure that `self` appears before `other` in `source_order`, we add the maximum
|
// To ensure that `self` appears before `other` in `source_order`, we add the maximum
|
||||||
// `source_order` of the lhs to all of the `source_order`s in the rhs.
|
// `source_order` of the lhs to all of the `source_order`s in the rhs.
|
||||||
let other_offset = self.max_source_order(db);
|
let other_offset = self.max_source_order(db);
|
||||||
self.or_inner(db, other, other_offset)
|
self.or_inner(db, other, other_offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn or(self, db: &'db dyn Db, other: Self) -> Self {
|
||||||
|
self.or_inner(db, other, 0)
|
||||||
|
}
|
||||||
|
|
||||||
fn or_inner(self, db: &'db dyn Db, other: Self, other_offset: usize) -> Self {
|
fn or_inner(self, db: &'db dyn Db, other: Self, other_offset: usize) -> Self {
|
||||||
match (self, other) {
|
match (self, other) {
|
||||||
(Node::AlwaysTrue, Node::AlwaysTrue) => Node::AlwaysTrue,
|
(Node::AlwaysTrue, Node::AlwaysTrue) => Node::AlwaysTrue,
|
||||||
|
|
@ -1118,13 +1122,17 @@ impl<'db> Node<'db> {
|
||||||
///
|
///
|
||||||
/// In the result, `self` will appear before `other` according to the `source_order` of the BDD
|
/// In the result, `self` will appear before `other` according to the `source_order` of the BDD
|
||||||
/// nodes.
|
/// nodes.
|
||||||
fn and(self, db: &'db dyn Db, other: Self) -> Self {
|
fn and_with_offset(self, db: &'db dyn Db, other: Self) -> Self {
|
||||||
// To ensure that `self` appears before `other` in `source_order`, we add the maximum
|
// To ensure that `self` appears before `other` in `source_order`, we add the maximum
|
||||||
// `source_order` of the lhs to all of the `source_order`s in the rhs.
|
// `source_order` of the lhs to all of the `source_order`s in the rhs.
|
||||||
let other_offset = self.max_source_order(db);
|
let other_offset = self.max_source_order(db);
|
||||||
self.and_inner(db, other, other_offset)
|
self.and_inner(db, other, other_offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn and(self, db: &'db dyn Db, other: Self) -> Self {
|
||||||
|
self.and_inner(db, other, 0)
|
||||||
|
}
|
||||||
|
|
||||||
fn and_inner(self, db: &'db dyn Db, other: Self, other_offset: usize) -> Self {
|
fn and_inner(self, db: &'db dyn Db, other: Self, other_offset: usize) -> Self {
|
||||||
match (self, other) {
|
match (self, other) {
|
||||||
(Node::AlwaysFalse, Node::AlwaysFalse) => Node::AlwaysFalse,
|
(Node::AlwaysFalse, Node::AlwaysFalse) => Node::AlwaysFalse,
|
||||||
|
|
@ -1160,13 +1168,17 @@ impl<'db> Node<'db> {
|
||||||
///
|
///
|
||||||
/// In the result, `self` will appear before `other` according to the `source_order` of the BDD
|
/// In the result, `self` will appear before `other` according to the `source_order` of the BDD
|
||||||
/// nodes.
|
/// nodes.
|
||||||
fn iff(self, db: &'db dyn Db, other: Self) -> Self {
|
fn iff_with_offset(self, db: &'db dyn Db, other: Self) -> Self {
|
||||||
// To ensure that `self` appears before `other` in `source_order`, we add the maximum
|
// To ensure that `self` appears before `other` in `source_order`, we add the maximum
|
||||||
// `source_order` of the lhs to all of the `source_order`s in the rhs.
|
// `source_order` of the lhs to all of the `source_order`s in the rhs.
|
||||||
let other_offset = self.max_source_order(db);
|
let other_offset = self.max_source_order(db);
|
||||||
self.iff_inner(db, other, other_offset)
|
self.iff_inner(db, other, other_offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn iff(self, db: &'db dyn Db, other: Self) -> Self {
|
||||||
|
self.iff_inner(db, other, 0)
|
||||||
|
}
|
||||||
|
|
||||||
fn iff_inner(self, db: &'db dyn Db, other: Self, other_offset: usize) -> Self {
|
fn iff_inner(self, db: &'db dyn Db, other: Self, other_offset: usize) -> Self {
|
||||||
match (self, other) {
|
match (self, other) {
|
||||||
(Node::AlwaysFalse, Node::AlwaysFalse) | (Node::AlwaysTrue, Node::AlwaysTrue) => {
|
(Node::AlwaysFalse, Node::AlwaysFalse) | (Node::AlwaysTrue, Node::AlwaysTrue) => {
|
||||||
|
|
@ -3568,7 +3580,7 @@ impl<'db> BoundTypeVarInstance<'db> {
|
||||||
for constraint in constraints.elements(db) {
|
for constraint in constraints.elements(db) {
|
||||||
let constraint_lower = constraint.bottom_materialization(db);
|
let constraint_lower = constraint.bottom_materialization(db);
|
||||||
let constraint_upper = constraint.top_materialization(db);
|
let constraint_upper = constraint.top_materialization(db);
|
||||||
specializations = specializations.or(
|
specializations = specializations.or_with_offset(
|
||||||
db,
|
db,
|
||||||
ConstrainedTypeVar::new_node(db, self, constraint_lower, constraint_upper),
|
ConstrainedTypeVar::new_node(db, self, constraint_lower, constraint_upper),
|
||||||
);
|
);
|
||||||
|
|
@ -3618,7 +3630,8 @@ impl<'db> BoundTypeVarInstance<'db> {
|
||||||
let constraint =
|
let constraint =
|
||||||
ConstrainedTypeVar::new_node(db, self, constraint_lower, constraint_upper);
|
ConstrainedTypeVar::new_node(db, self, constraint_lower, constraint_upper);
|
||||||
if constraint_lower == constraint_upper {
|
if constraint_lower == constraint_upper {
|
||||||
non_gradual_constraints = non_gradual_constraints.or(db, constraint);
|
non_gradual_constraints =
|
||||||
|
non_gradual_constraints.or_with_offset(db, constraint);
|
||||||
} else {
|
} else {
|
||||||
gradual_constraints.push(constraint);
|
gradual_constraints.push(constraint);
|
||||||
}
|
}
|
||||||
|
|
@ -3659,7 +3672,7 @@ impl<'db> GenericContext<'db> {
|
||||||
let abstracted = self
|
let abstracted = self
|
||||||
.variables(db)
|
.variables(db)
|
||||||
.fold(constraints.node, |constraints, bound_typevar| {
|
.fold(constraints.node, |constraints, bound_typevar| {
|
||||||
constraints.and(db, bound_typevar.valid_specializations(db))
|
constraints.and_with_offset(db, bound_typevar.valid_specializations(db))
|
||||||
});
|
});
|
||||||
tracing::debug!(
|
tracing::debug!(
|
||||||
target: "ty_python_semantic::types::constraints::specialize_constrained",
|
target: "ty_python_semantic::types::constraints::specialize_constrained",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue