fix(tvix/eval): correctly resolve identifiers in inherit
This should not have grown a second implementation of the identifier resolution logic, but it somehow did. This implementation ended up being incorrect because it did not account for upvalues inside of thunks. Change-Id: Ieb1364d8fe43c96aaf4b125fd4b8a522aedff167 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6360 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
17dfb92a9f
commit
a8b2ba07df
1 changed files with 4 additions and 21 deletions
|
@ -442,29 +442,12 @@ impl Compiler {
|
||||||
None => {
|
None => {
|
||||||
for ident in inherit.idents() {
|
for ident in inherit.idents() {
|
||||||
count += 1;
|
count += 1;
|
||||||
|
|
||||||
|
// Emit the key to use for OpAttrs
|
||||||
self.emit_literal_ident(&ident);
|
self.emit_literal_ident(&ident);
|
||||||
|
|
||||||
match self
|
// Emit the value.
|
||||||
.scope_mut()
|
self.compile_ident(slot, ident);
|
||||||
.resolve_local(ident.ident_token().unwrap().text())
|
|
||||||
{
|
|
||||||
LocalPosition::Unknown => {
|
|
||||||
self.emit_error(
|
|
||||||
ident.syntax().clone(),
|
|
||||||
ErrorKind::UnknownStaticVariable,
|
|
||||||
);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
LocalPosition::Known(idx) => {
|
|
||||||
let stack_idx = self.scope().stack_index(idx);
|
|
||||||
self.chunk().push_op(OpCode::OpGetLocal(stack_idx))
|
|
||||||
}
|
|
||||||
|
|
||||||
LocalPosition::Recursive(_) => {
|
|
||||||
todo!("TODO: should be unreachable in inherits, check")
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue