From 22776280b59f1efa0b63bd7efa6612a3827f8c65 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 30 Jan 2023 00:45:40 +0300 Subject: feat(tvix/eval): unthunk empty lists and attribute sets Change-Id: Ie66cb1b163a544d45d113fd0f866286f230b0188 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7960 Tested-by: BuildkiteCI Reviewed-by: grfn --- tvix/eval/src/compiler/bindings.rs | 4 ++++ tvix/eval/src/compiler/mod.rs | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'tvix') diff --git a/tvix/eval/src/compiler/bindings.rs b/tvix/eval/src/compiler/bindings.rs index 2e703aadc876..a3d7c6fbfb33 100644 --- a/tvix/eval/src/compiler/bindings.rs +++ b/tvix/eval/src/compiler/bindings.rs @@ -658,6 +658,10 @@ impl Compiler<'_> { if kind.is_attrs() { self.push_op(OpCode::OpAttrs(Count(count)), node); } + + if count == 0 { + self.unthunk(); + } } /// Compile a standard `let ...; in ...` expression. diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs index bfb823b673c5..c7061c77a02a 100644 --- a/tvix/eval/src/compiler/mod.rs +++ b/tvix/eval/src/compiler/mod.rs @@ -592,6 +592,10 @@ impl Compiler<'_> { self.scope_mut().mark_initialised(item_slot); } + if count == 0 { + self.unthunk(); + } + self.push_op(OpCode::OpList(Count(count)), node); self.scope_mut().end_scope(); } -- cgit 1.4.1