about summary refs log tree commit diff
path: root/tvix/eval/src
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-12-12T06·48-0800
committerclbot <clbot@tvl.fyi>2023-12-12T15·48+0000
commit289663cac4c1acd75ea850f1622ec8fee9eeff44 (patch)
tree86628fabe6a551e2c3532535a27407fee78b3b28 /tvix/eval/src
parente54533518bf1143334a3910b393815b6edad8c66 (diff)
fix(tvix/eval): handle catchables in attribute set updates r/7182
Fixes b/346.

Change-Id: I277121d2363e605ebe09651ed9440fe1bc126c8c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10292
Tested-by: BuildkiteCI
Autosubmit: Adam Joseph <adam@westernsemico.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/eval/src')
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-update-attrs.exp (renamed from tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-catchable-in-update-attrs.exp)0
-rw-r--r--tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-update-attrs.nix (renamed from tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-catchable-in-update-attrs.nix)0
-rw-r--r--tvix/eval/src/vm/mod.rs15
3 files changed, 11 insertions, 4 deletions
diff --git a/tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-catchable-in-update-attrs.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-update-attrs.exp
index c508d5366f..c508d5366f 100644
--- a/tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-catchable-in-update-attrs.exp
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-update-attrs.exp
diff --git a/tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-catchable-in-update-attrs.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-update-attrs.nix
index 38a9169034..38a9169034 100644
--- a/tvix/eval/src/tests/tvix_tests/notyetpassing/eval-okay-catchable-in-update-attrs.nix
+++ b/tvix/eval/src/tests/tvix_tests/eval-okay-catchable-in-update-attrs.nix
diff --git a/tvix/eval/src/vm/mod.rs b/tvix/eval/src/vm/mod.rs
index 642b6317ca..312d1b8935 100644
--- a/tvix/eval/src/vm/mod.rs
+++ b/tvix/eval/src/vm/mod.rs
@@ -661,10 +661,17 @@ impl<'o> VM<'o> {
                 OpCode::OpAttrs(Count(count)) => self.run_attrset(&frame, count)?,
 
                 OpCode::OpAttrsUpdate => {
-                    let rhs = self.stack_pop().to_attrs().with_span(&frame, self)?;
-                    let lhs = self.stack_pop().to_attrs().with_span(&frame, self)?;
-
-                    self.stack.push(Value::attrs(lhs.update(*rhs)))
+                    let rhs = self.stack_pop();
+                    let lhs = self.stack_pop();
+                    if lhs.is_catchable() {
+                        self.stack.push(lhs);
+                    } else if rhs.is_catchable() {
+                        self.stack.push(rhs);
+                    } else {
+                        let rhs = rhs.to_attrs().with_span(&frame, self)?;
+                        let lhs = lhs.to_attrs().with_span(&frame, self)?;
+                        self.stack.push(Value::attrs(lhs.update(*rhs)))
+                    }
                 }
 
                 OpCode::OpInvert => {