diff options
author | Vincent Ambo <mail@tazj.in> | 2022-08-13T17·39+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-08-29T20·13+0000 |
commit | ab12b0abff094e58de3af0794f1977bfadbf83a1 (patch) | |
tree | ea6e708651b3063e819fb44535fcc1e0a8ae6c2d /tvix/eval/src | |
parent | 36748fe4f65d85049c5aec2df4828668803ad30b (diff) |
fix(tvix/eval): skip inherit with no explicit parent in let r/4528
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 <grfn@gws.fyi>
Diffstat (limited to 'tvix/eval/src')
-rw-r--r-- | tvix/eval/src/compiler.rs | 9 |
1 files changed, 7 insertions, 2 deletions
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 |