about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
Diffstat (limited to 'tvix')
-rw-r--r--tvix/eval/src/compiler/bindings.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tvix/eval/src/compiler/bindings.rs b/tvix/eval/src/compiler/bindings.rs
index 93b3dc3cc666..83667c129be0 100644
--- a/tvix/eval/src/compiler/bindings.rs
+++ b/tvix/eval/src/compiler/bindings.rs
@@ -640,6 +640,15 @@ impl Compiler<'_> {
         self.declare_namespaced_inherits(kind, inherit_froms, &mut bindings);
         self.declare_bindings(kind, &mut count, &mut bindings, node);
 
+        // Check if we can bail out on empty bindings
+        if count == 0 {
+            // still need an attrset to exist, but it is empty.
+            if kind.is_attrs() {
+                self.emit_constant(Value::Attrs(Box::new(NixAttrs::empty())), node);
+                return;
+            }
+        }
+
         // Actually bind values and ensure they are on the stack.
         self.bind_values(bindings);