about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-10-22T16·58+0300
committertazjin <tazjin@tvl.su>2022-10-23T15·50+0000
commit5b305fab409be662092ab8214db7c4c1c91b8fb8 (patch)
tree9439c5295f3dd9c0ca9406a702e37ec82ff5929f /tvix
parent9b52e5b9c2917bffc8405433a2c373a26cfe0c6e (diff)
fix(tvix/eval): fix condition for useless inherit warning r/5183
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 <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix')
-rw-r--r--tvix/eval/src/compiler/bindings.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tvix/eval/src/compiler/bindings.rs b/tvix/eval/src/compiler/bindings.rs
index 4283b21276d4..31ab76aee815 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;
                 }