From 2aab01ac298c81c3f504c1ac2608ee9aaf88346b Mon Sep 17 00:00:00 2001 From: sterni Date: Sat, 27 May 2023 21:21:43 +0200 Subject: fix(tvix/eval): thunk HasAttr expressions 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 Tested-by: BuildkiteCI Reviewed-by: tazjin --- tvix/eval/src/compiler/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tvix/eval/src/compiler') 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)), -- cgit 1.4.1