about summary refs log tree commit diff
path: root/tvix/eval
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-03-13T09·21+0300
committerclbot <clbot@tvl.fyi>2023-03-17T19·40+0000
commit80aaadfc199c4038b69c89f3493528f09c28efc2 (patch)
treef51db07b1962e2f01ac572f0a2f5b01f8ed96921 /tvix/eval
parent8c13f18d114cfaaa3b6a9907a04a57c3fe7733b4 (diff)
fix(tvix/eval): use span of `set` for OpForce in attribute access r/6027
Emits the span of the `set` that is being accessed in the `force`
operation of an attribute access.

Looking at traces, it's a lot more useful to get information about
*what* is being forced, as in cases like `foo.bar` it can be
misleading to have an error highlight `bar`, when the error occured
while forcing `foo` to be able to access `bar` in the first place.

Change-Id: Id46ff28f20c67cb4971727ac52cc4811795cea2d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8272
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval')
-rw-r--r--tvix/eval/src/compiler/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index 51dc49242882..7f090978db99 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -683,7 +683,7 @@ impl Compiler<'_> {
         }
 
         // Push the set onto the stack
-        self.compile(slot, set);
+        self.compile(slot, set.clone());
         if self.optimise_select(&path) {
             return;
         }
@@ -694,7 +694,7 @@ impl Compiler<'_> {
         // nested selects.
         for fragment in path.attrs() {
             // Force the current set value.
-            self.emit_force(&fragment);
+            self.emit_force(&set);
 
             self.compile_attr(slot, &fragment);
             self.push_op(OpCode::OpAttrsSelect, &fragment);