Skip to content

Commit

Permalink
Should A ∧ !A always be false?
Browse files Browse the repository at this point in the history
  • Loading branch information
dcreager committed Jan 30, 2025
1 parent 4f2aea8 commit 93efda5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions crates/red_knot_python_semantic/src/visibility_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,18 @@ impl<'db> VisibilityConstraints<'db> {
b: ScopedVisibilityConstraintId,
) -> ScopedVisibilityConstraintId {
if a == ScopedVisibilityConstraintId::ALWAYS_TRUE {
b
return b;
} else if b == ScopedVisibilityConstraintId::ALWAYS_TRUE {
a
} else {
self.add(VisibilityConstraint::KleeneAnd(a, b))
return a;
}
match (&self.constraints[a], &self.constraints[b]) {
(_, VisibilityConstraint::VisibleIfNot(id)) if a == *id => self.add(
VisibilityConstraint::VisibleIfNot(ScopedVisibilityConstraintId::ALWAYS_TRUE),
),
(VisibilityConstraint::VisibleIfNot(id), _) if *id == b => self.add(
VisibilityConstraint::VisibleIfNot(ScopedVisibilityConstraintId::ALWAYS_TRUE),
),
_ => self.add(VisibilityConstraint::KleeneAnd(a, b)),
}
}

Expand Down

0 comments on commit 93efda5

Please sign in to comment.