fix(tvix/eval): propagate catchables through &&

Change-Id: I7bb5ac1ef47b41c47269e64cee0e90eb64c6fcce
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10322
Autosubmit: Adam Joseph <adam@westernsemico.com>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Adam Joseph 2023-12-12 04:22:23 -08:00 committed by clbot
parent bcc1ea8552
commit bb1e79e5d1
3 changed files with 4 additions and 0 deletions

View file

@ -546,6 +546,7 @@ impl Compiler<'_> {
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);
// If this value is false, jump over the right-hand side - the // If this value is false, jump over the right-hand side - the
// whole expression is false. // whole expression is false.
let end_idx = self.push_op(OpCode::OpJumpIfFalse(JumpOffset(0)), node); let end_idx = self.push_op(OpCode::OpJumpIfFalse(JumpOffset(0)), node);
@ -559,6 +560,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);
} }
fn compile_or(&mut self, slot: LocalIdx, node: &ast::BinOp) { fn compile_or(&mut self, slot: LocalIdx, node: &ast::BinOp) {

View file

@ -0,0 +1 @@
false

View file

@ -0,0 +1 @@
(builtins.tryEval ( (throw "fred") && (throw "jill") )).success