fix(tvix/eval): manually count entries in recursive scopes

The previous version had a bug where we assumed that the number of
entries in an attribute set AST node would be equivalent to the number
of entries in the runtime attribute set, but due to inherit nodes
containing a variable number of entries, this did not work out.

Fixes b/199

Change-Id: I6f7f7729f3512b297cf29a2e046302ca28477854
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6749
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2022-09-23 00:51:19 +03:00 committed by tazjin
parent bd9cda2af7
commit 1015f2f8e7
4 changed files with 14 additions and 4 deletions

View file

@ -241,8 +241,8 @@ impl Compiler<'_> {
self.scope_mut().begin_scope();
if node.rec_token().is_some() {
self.compile_recursive_scope(slot, true, &node);
self.push_op(OpCode::OpAttrs(Count(node.entries().count())), &node);
let count = self.compile_recursive_scope(slot, true, &node);
self.push_op(OpCode::OpAttrs(Count(count)), &node);
} else {
let mut count = self.compile_inherit_attrs(slot, node.inherits());