about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-29T19·06+0300
committertazjin <tazjin@tvl.su>2022-09-07T15·25+0000
commit9420a3b53d47b0a71d837e312c49fb1d94af1592 (patch)
treec8e555b9585dd43f603b2370c40eddbacb5635b6
parent5b4f3811e6d1683c30ce293b4019eb2ecb50cb09 (diff)
feat(tvix/eval): insert strictness points for attribute set keys r/4694
All attribute set *key* related operations strictly evaluate all key
fragments, including during construction of an attribute set.

Change-Id: I3519e5e9b0886c2cdc8615ea7dcb5f7be0c59b3f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6358
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
-rw-r--r--tvix/eval/src/compiler/mod.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index b3315ee9119e..8a2fb5eb97e2 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -367,8 +367,16 @@ impl Compiler {
 
     fn compile_attr(&mut self, slot: Option<LocalIdx>, node: ast::Attr) {
         match node {
-            ast::Attr::Dynamic(dynamic) => self.compile(slot, dynamic.expr().unwrap()),
-            ast::Attr::Str(s) => self.compile_str(slot, s),
+            ast::Attr::Dynamic(dynamic) => {
+                self.compile(slot, dynamic.expr().unwrap());
+                self.emit_force();
+            }
+
+            ast::Attr::Str(s) => {
+                self.compile_str(slot, s);
+                self.emit_force();
+            }
+
             ast::Attr::Ident(ident) => self.emit_literal_ident(&ident),
         }
     }