fix(tvix/eval): handle catchables in attribute set updates
Fixes b/346. Change-Id: I277121d2363e605ebe09651ed9440fe1bc126c8c Reviewed-on: https://cl.tvl.fyi/c/depot/+/10292 Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
e54533518b
commit
289663cac4
3 changed files with 11 additions and 4 deletions
|
@ -661,10 +661,17 @@ impl<'o> VM<'o> {
|
||||||
OpCode::OpAttrs(Count(count)) => self.run_attrset(&frame, count)?,
|
OpCode::OpAttrs(Count(count)) => self.run_attrset(&frame, count)?,
|
||||||
|
|
||||||
OpCode::OpAttrsUpdate => {
|
OpCode::OpAttrsUpdate => {
|
||||||
let rhs = self.stack_pop().to_attrs().with_span(&frame, self)?;
|
let rhs = self.stack_pop();
|
||||||
let lhs = self.stack_pop().to_attrs().with_span(&frame, self)?;
|
let lhs = self.stack_pop();
|
||||||
|
if lhs.is_catchable() {
|
||||||
self.stack.push(Value::attrs(lhs.update(*rhs)))
|
self.stack.push(lhs);
|
||||||
|
} else if rhs.is_catchable() {
|
||||||
|
self.stack.push(rhs);
|
||||||
|
} else {
|
||||||
|
let rhs = rhs.to_attrs().with_span(&frame, self)?;
|
||||||
|
let lhs = lhs.to_attrs().with_span(&frame, self)?;
|
||||||
|
self.stack.push(Value::attrs(lhs.update(*rhs)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OpCode::OpInvert => {
|
OpCode::OpInvert => {
|
||||||
|
|
Loading…
Reference in a new issue