fix(tvix/eval): use span of set for OpForce in attribute access

Emits the span of the `set` that is being accessed in the `force`
operation of an attribute access.

Looking at traces, it's a lot more useful to get information about
*what* is being forced, as in cases like `foo.bar` it can be
misleading to have an error highlight `bar`, when the error occured
while forcing `foo` to be able to access `bar` in the first place.

Change-Id: Id46ff28f20c67cb4971727ac52cc4811795cea2d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8272
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2023-03-13 12:21:31 +03:00 committed by clbot
parent 8c13f18d11
commit 80aaadfc19

View file

@ -683,7 +683,7 @@ impl Compiler<'_> {
}
// Push the set onto the stack
self.compile(slot, set);
self.compile(slot, set.clone());
if self.optimise_select(&path) {
return;
}
@ -694,7 +694,7 @@ impl Compiler<'_> {
// nested selects.
for fragment in path.attrs() {
// Force the current set value.
self.emit_force(&fragment);
self.emit_force(&set);
self.compile_attr(slot, &fragment);
self.push_op(OpCode::OpAttrsSelect, &fragment);