diff options
author | Vincent Ambo <mail@tazj.in> | 2022-09-18T17·18+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-09-18T22·16+0000 |
commit | bcbe1603c8d50b69705fb737961b6a4827a50591 (patch) | |
tree | eeb5ceb378e8a3d2a6032ac2ac0476ab8f670281 /tvix/eval/src/compiler/attrs.rs | |
parent | d42d8f3089c524cfa9e2fc332a81af5c0686db8d (diff) |
fix(tvix/eval): ensure all thunks are forced in nested selects r/4913
Previously only the first one was guaranteed to be forced, but we need to do this for all of them. Fixes b/190 Change-Id: I76b5667dbfb2f3fde3587e7b91d268cbf32aca00 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6645 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/eval/src/compiler/attrs.rs')
-rw-r--r-- | tvix/eval/src/compiler/attrs.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tvix/eval/src/compiler/attrs.rs b/tvix/eval/src/compiler/attrs.rs index 1584d5017aa2..5dee3a905d01 100644 --- a/tvix/eval/src/compiler/attrs.rs +++ b/tvix/eval/src/compiler/attrs.rs @@ -270,13 +270,15 @@ impl Compiler<'_> { // Push the set onto the stack self.compile(slot, set.clone()); - self.emit_force(&set); // Compile each key fragment and emit access instructions. // // TODO: multi-select instruction to avoid re-pushing attrs on // nested selects. for fragment in path.attrs() { + // Force the current set value. + self.emit_force(&fragment); + self.compile_attr(slot, fragment.clone()); self.push_op(OpCode::OpAttrsSelect, &fragment); } @@ -319,10 +321,10 @@ impl Compiler<'_> { default: ast::Expr, ) { self.compile(slot, set.clone()); - self.emit_force(&set); let mut jumps = vec![]; for fragment in path.attrs() { + self.emit_force(&fragment); self.compile_attr(slot, fragment.clone()); self.push_op(OpCode::OpAttrsTrySelect, &fragment); jumps.push(self.push_op(OpCode::OpJumpIfNotFound(JumpOffset(0)), &fragment)); |