From 5b305fab409be662092ab8214db7c4c1c91b8fb8 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 22 Oct 2022 19:58:35 +0300 Subject: fix(tvix/eval): fix condition for useless inherit warning The warning needs to consider whether it is occuring inside of a thunk, i.e. the dynamic ancestry chain of lambda contexts must be inspected and not just the current scope. Change-Id: I5cf5482d67a8bbb9f03b0ecee7a62f58754f8e59 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7063 Tested-by: BuildkiteCI Reviewed-by: sterni Reviewed-by: grfn --- tvix/eval/src/compiler/bindings.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tvix/eval/src/compiler/bindings.rs b/tvix/eval/src/compiler/bindings.rs index 4283b21276..31ab76aee8 100644 --- a/tvix/eval/src/compiler/bindings.rs +++ b/tvix/eval/src/compiler/bindings.rs @@ -323,8 +323,8 @@ impl Compiler<'_> { for inherit in node.inherits() { match inherit.from() { // Within a `let` binding, inheriting from the outer scope is a - // no-op *if* the scope is fully static. - None if !kind.is_attrs() && !self.scope().has_with() => { + // no-op *if* there are no dynamic bindings. + None if !kind.is_attrs() && !self.has_dynamic_ancestor() => { self.emit_warning(&inherit, WarningKind::UselessInherit); continue; } -- cgit 1.4.1