From ab12b0abff094e58de3af0794f1977bfadbf83a1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 13 Aug 2022 20:39:25 +0300 Subject: fix(tvix/eval): skip inherit with no explicit parent in let Using `inherit` in a let-binding can not possibly have an effect, as the given identifier is already bound exactly the same way in the current scope. This introduces a subtle bug that is fixed later on, as there actually *is* a (single) condition where these inherits are meaningful. Change-Id: I8b24f0edcfe80db8153bb7e86cf478d36957d6f8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6192 Tested-by: BuildkiteCI Reviewed-by: grfn --- tvix/eval/src/compiler.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tvix/eval') diff --git a/tvix/eval/src/compiler.rs b/tvix/eval/src/compiler.rs index ac630360d403..e2d194e8ddbb 100644 --- a/tvix/eval/src/compiler.rs +++ b/tvix/eval/src/compiler.rs @@ -676,8 +676,13 @@ impl Compiler { }); } - for _ in node.inherits() { - todo!("inherit in let not yet implemented") + for inherit in node.inherits() { + match inherit.from() { + // Within a `let` binding, inheriting from the outer + // scope is practically a no-op. + None => continue, + Some(_) => todo!("let inherit from attrs"), + } } // Now we can compile each expression, leaving the values on -- cgit 1.4.1