fix(tvix/eval): emit correct count in OpAttrPath

Not sure how exactly this snuck in, but it caused some subtle
breakages in deeply nested attribute sets.

Change-Id: I8049ce912405d3750031f79cc8d86ff1c3c02c2b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6208
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2022-08-14 14:15:26 +03:00 committed by tazjin
parent 8d45fbadea
commit 43658a5b90
4 changed files with 4 additions and 2 deletions

View file

@ -393,7 +393,7 @@ impl Compiler {
// otherwise we need to emit an instruction to construct // otherwise we need to emit an instruction to construct
// the attribute path. // the attribute path.
if key_count > 1 { if key_count > 1 {
self.chunk.push_op(OpCode::OpAttrPath(2)); self.chunk.push_op(OpCode::OpAttrPath(key_count));
} }
// The value is just compiled as normal so that its // The value is just compiled as normal so that its

View file

@ -0,0 +1 @@
{ a = { b = { c = { d = { e = { f = { g = "deep!"; }; }; }; }; }; }; }

View file

@ -0,0 +1 @@
{ a.b.c.d.e.f.g = "deep!"; }

View file

@ -253,7 +253,7 @@ impl NixAttrs {
continue; continue;
} }
other => panic!("unexpected attribute key type: {}", other.type_of()), other => panic!("unexpected attribute key: {} :: {}", other, other.type_of()),
} }
} }