refactor(tvix/eval): point OpAssert span at condition

This is more useful than pointing it at the entire assert expression,
as that includes the body as well which is not going to be relevant in
the error.

Pointed out by sterni in cl/6391

Change-Id: I95a5d1edf90df65e7fa53d4d04502afd6e99e89a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6566
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2022-09-13 16:08:40 +03:00 committed by tazjin
parent 30de72fefb
commit 62623ef46c

View file

@ -515,7 +515,7 @@ impl Compiler<'_, '_> {
fn compile_assert(&mut self, slot: LocalIdx, node: ast::Assert) { fn compile_assert(&mut self, slot: LocalIdx, node: ast::Assert) {
// Compile the assertion condition to leave its value on the stack. // Compile the assertion condition to leave its value on the stack.
self.compile(slot, node.condition().unwrap()); self.compile(slot, node.condition().unwrap());
self.push_op(OpCode::OpAssert, &node); self.push_op(OpCode::OpAssert, &node.condition().unwrap());
// The runtime will abort evaluation at this point if the // The runtime will abort evaluation at this point if the
// assertion failed, if not the body simply continues on like // assertion failed, if not the body simply continues on like