about summary refs log tree commit diff
path: root/tvix/eval/src
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src')
-rw-r--r--tvix/eval/src/compiler/mod.rs2
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-logical-or-catchable.exp1
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-logical-or-catchable.nix1
3 files changed, 4 insertions, 0 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index 831b92b67a..451fa44de7 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -572,6 +572,7 @@ impl Compiler<'_> {
         self.compile(slot, node.lhs().unwrap());
         self.emit_force(&node.lhs().unwrap());
 
+        let throw_idx = self.push_op(OpCode::OpJumpIfCatchable(JumpOffset(0)), node);
         // Opposite of above: If this value is **true**, we can
         // short-circuit the right-hand side.
         let end_idx = self.push_op(OpCode::OpJumpIfTrue(JumpOffset(0)), node);
@@ -581,6 +582,7 @@ impl Compiler<'_> {
 
         self.patch_jump(end_idx);
         self.push_op(OpCode::OpAssertBool, node);
+        self.patch_jump(throw_idx);
     }
 
     fn compile_implication(&mut self, slot: LocalIdx, node: &ast::BinOp) {
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-logical-or-catchable.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-logical-or-catchable.exp
new file mode 100644
index 0000000000..c508d5366f
--- /dev/null
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-logical-or-catchable.exp
@@ -0,0 +1 @@
+false
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-logical-or-catchable.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-logical-or-catchable.nix
new file mode 100644
index 0000000000..64168499c6
--- /dev/null
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-logical-or-catchable.nix
@@ -0,0 +1 @@
+(builtins.tryEval (  (throw "fred") || (throw "jill") )).success