Skip to content

Commit

Permalink
Post-rebase fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
yannham committed Oct 16, 2023
1 parent 03be479 commit d2557aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
7 changes: 3 additions & 4 deletions core/src/closurize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl Closurize for RichTerm {
//
let pos = self.pos;

let idx = match_sharedterm! { self, with {
let idx = match_sharedterm!( match (self) {
// We should always find a generated variable in the environment, but this method is
// not fallible, so we just wrap it in a new closure which will
// give an unbound identifier error if it's ever evaluated.
Expand All @@ -112,16 +112,15 @@ impl Closurize for RichTerm {
},
// If we just need a normal closure, and we find a normal closure inside the thunk, we can just reuse it
Term::Closure(idx) if idx.deps().is_empty() && matches!(btype, BindingType::Normal) => idx,
}
else {
_ => {
// It's suspicious to wrap a closure with existing dependencies in a new closure
// with set dependencies, although I'm not sure it would actually break anything.
// We panic in debug mode to catch this case.
debug_assert!(!matches!((self.as_ref(), &btype), (Term::Closure(idx), BindingType::Revertible(_)) if !idx.deps().is_empty()), "wrapping a closure with non-empty deps in a new closure with different deps");

cache.add(Closure { body: self, env}, btype)
}
};
});

RichTerm::new(Term::Closure(idx), pos.into_inherited())
}
Expand Down
5 changes: 0 additions & 5 deletions core/src/eval/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1826,11 +1826,6 @@ impl<R: ImportResolver, C: Cache> VirtualMachine<R, C> {
.closurize(&mut self.cache, env1.clone())
}));

ts.extend(ts1.into_iter().map(|t| {
RuntimeContract::apply_all(t, ctrs_left.iter().cloned(), pos1)
.closurize(&mut self.cache, env1.clone())
}));

ts.extend(ts2.into_iter().map(|t| {
RuntimeContract::apply_all(t, ctrs_right.clone(), pos2)
.closurize(&mut self.cache, env2.clone())
Expand Down

0 comments on commit d2557aa

Please sign in to comment.