fix(tvix/eval): fix recovering from throws in implications

This fixes b/345.

Change-Id: Ic0d3b6ffacd2a5e0050d22354d08320b69a4fe13
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10290
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: Adam Joseph <adam@westernsemico.com>
This commit is contained in:
Adam Joseph 2023-12-11 22:41:52 -08:00 committed by clbot
parent 24ff74d346
commit edf411a86c
3 changed files with 2 additions and 0 deletions

View file

@ -593,6 +593,7 @@ impl Compiler<'_> {
// Leave left-hand side value on the stack and invert it. // Leave left-hand side value on the stack and invert it.
self.compile(slot, node.lhs().unwrap()); self.compile(slot, node.lhs().unwrap());
self.emit_force(&node.lhs().unwrap()); self.emit_force(&node.lhs().unwrap());
let throw_idx = self.push_op(OpCode::OpJumpIfCatchable(JumpOffset(0)), node);
self.push_op(OpCode::OpInvert, node); self.push_op(OpCode::OpInvert, node);
// Exactly as `||` (because `a -> b` = `!a || b`). // Exactly as `||` (because `a -> b` = `!a || b`).
@ -603,6 +604,7 @@ impl Compiler<'_> {
self.patch_jump(end_idx); self.patch_jump(end_idx);
self.push_op(OpCode::OpAssertBool, node); self.push_op(OpCode::OpAssertBool, node);
self.patch_jump(throw_idx);
} }
/// Compile list literals into equivalent bytecode. List /// Compile list literals into equivalent bytecode. List