about summary refs log tree commit diff
path: root/tvix/eval/src/compiler
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2023-05-27T19·21+0200
committerclbot <clbot@tvl.fyi>2023-05-29T12·44+0000
commit2aab01ac298c81c3f504c1ac2608ee9aaf88346b (patch)
treed22ba6c0fed96e036b4f89fe3d76966353ba1133 /tvix/eval/src/compiler
parent9d0425acc0eef553cb0c3023908f7de4c1e2de82 (diff)
fix(tvix/eval): thunk HasAttr expressions r/6216
HasAttrs was weird because with longer attribute paths it would
sometimes not turn out to be a thunk. If it was a thunk, it'd usually
still do some eval strictly which we'll want to avoid.

Verified against C++ Nix using a new test suite introduced in a later
CL.

Change-Id: I6d047ccc68d046bb268462f170a3c4f3c5ddeffe
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8656
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/eval/src/compiler')
-rw-r--r--tvix/eval/src/compiler/mod.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index 8d2e8d6b23fb..773fc0f053ab 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -257,7 +257,9 @@ impl Compiler<'_> {
                 self.thunk(slot, binop, move |c, s| c.compile_binop(s, binop))
             }
 
-            ast::Expr::HasAttr(has_attr) => self.compile_has_attr(slot, has_attr),
+            ast::Expr::HasAttr(has_attr) => {
+                self.thunk(slot, has_attr, move |c, s| c.compile_has_attr(s, has_attr))
+            }
 
             ast::Expr::List(list) => self.thunk(slot, list, move |c, s| c.compile_list(s, list)),