back to customizable return type

This commit is contained in:
Douglas Creager 2025-11-14 10:31:46 -05:00
parent 206ef2527f
commit 68e1b9675b

View file

@ -735,15 +735,19 @@ impl<'db> Node<'db> {
Node::AlwaysFalse => false, Node::AlwaysFalse => false,
Node::Interior(interior) => { Node::Interior(interior) => {
let constraint = interior.constraint(db); let constraint = interior.constraint(db);
path.assignment_satisfied(db, map, constraint.when_true(), |path| { path.with_assignment(db, map, constraint.when_true(), |path| {
interior interior
.if_true(db) .if_true(db)
.is_always_satisfied_inner(db, map, path) .is_always_satisfied_inner(db, map, path)
}) && path.assignment_satisfied(db, map, constraint.when_false(), |path| {
interior
.if_false(db)
.is_always_satisfied_inner(db, map, path)
}) })
.unwrap_or(true)
&& path
.with_assignment(db, map, constraint.when_false(), |path| {
interior
.if_false(db)
.is_always_satisfied_inner(db, map, path)
})
.unwrap_or(true)
} }
} }
} }
@ -2256,19 +2260,18 @@ struct SequentPath<'db> {
} }
impl<'db> SequentPath<'db> { impl<'db> SequentPath<'db> {
fn assignment_satisfied( fn with_assignment<R>(
&mut self, &mut self,
db: &'db dyn Db, db: &'db dyn Db,
map: &SequentMap<'db>, map: &SequentMap<'db>,
assignment: ConstraintAssignment<'db>, assignment: ConstraintAssignment<'db>,
f: impl FnOnce(&mut Self) -> bool, f: impl FnOnce(&mut Self) -> R,
) -> bool { ) -> Option<R> {
self.path.push(assignment); self.path.push(assignment);
let result = if self.path_should_be_pruned(db, map) { let result = if self.path_should_be_pruned(db, map) {
// A pruned path is vacuously satisfied None
true
} else { } else {
f(self) Some(f(self))
}; };
self.path.pop(); self.path.pop();
result result