From 83aa5917b411234b80a13fe5771e3d27eb95c985 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 27 Aug 2022 19:37:02 +0300 Subject: fix(tvix/eval): declare locals before marking them initialised This has no effect yet, other than changing the way in which some upvalue captures break (that are already not working correctly). However, after this change the compiler correctly detects self-recursion and can start emitting the instructions to deal with this at runtime. Change-Id: Id3b0ac206c0204739597a4325bcc66f9c806c242 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6309 Tested-by: BuildkiteCI Reviewed-by: sterni --- tvix/eval/src/compiler/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs index 8defea9a49..63ffe61bcd 100644 --- a/tvix/eval/src/compiler/mod.rs +++ b/tvix/eval/src/compiler/mod.rs @@ -833,9 +833,9 @@ impl Compiler { todo!("nested bindings in let expressions :(") } - self.compile(entry.value().unwrap()); let name = path.pop().unwrap(); self.declare_local(entry.attrpath().unwrap().syntax().clone(), &name); + self.compile(entry.value().unwrap()); self.mark_initialised(&name); } -- cgit 1.4.1