From 62623ef46ce6cf0a6e76806440b0321a7f3792a7 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 13 Sep 2022 16:08:40 +0300 Subject: 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 Tested-by: BuildkiteCI --- tvix/eval/src/compiler/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tvix/eval') diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs index bcf4abacd776..b22ab0a50663 100644 --- a/tvix/eval/src/compiler/mod.rs +++ b/tvix/eval/src/compiler/mod.rs @@ -515,7 +515,7 @@ impl Compiler<'_, '_> { fn compile_assert(&mut self, slot: LocalIdx, node: ast::Assert) { // Compile the assertion condition to leave its value on the stack. 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 // assertion failed, if not the body simply continues on like -- cgit 1.4.1