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 <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-10-22 19:58:35 +03:00 committed by tazjin
parent 9b52e5b9c2
commit 5b305fab40

View file

@ -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;
}