about summary refs log tree commit diff
path: root/tvix/eval
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-13T18·52+0300
committertazjin <tazjin@tvl.su>2022-08-29T20·13+0000
commit1cb19314069a74d526165a53d56bac5dfb3f9c9c (patch)
tree5cf6754b869ccbf956d121a3bb3a13199147afcd /tvix/eval
parentab12b0abff094e58de3af0794f1977bfadbf83a1 (diff)
feat(tvix/eval): emit warnings on useless inherit r/4529
Change-Id: Ifb9993cf8b85393eb43e1b204c7ab2f889b7113b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6194
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval')
-rw-r--r--tvix/eval/src/compiler.rs9
-rw-r--r--tvix/eval/src/warnings.rs1
2 files changed, 9 insertions, 1 deletions
diff --git a/tvix/eval/src/compiler.rs b/tvix/eval/src/compiler.rs
index e2d194e8ddbb..75ea99ea787c 100644
--- a/tvix/eval/src/compiler.rs
+++ b/tvix/eval/src/compiler.rs
@@ -680,7 +680,14 @@ impl Compiler {
             match inherit.from() {
                 // Within a `let` binding, inheriting from the outer
                 // scope is practically a no-op.
-                None => continue,
+                None => {
+                    self.warnings.push(EvalWarning {
+                        node: inherit.node().clone(),
+                        kind: WarningKind::UselessInherit,
+                    });
+
+                    continue;
+                }
                 Some(_) => todo!("let inherit from attrs"),
             }
         }
diff --git a/tvix/eval/src/warnings.rs b/tvix/eval/src/warnings.rs
index 44e47793c5dd..953f93ff467e 100644
--- a/tvix/eval/src/warnings.rs
+++ b/tvix/eval/src/warnings.rs
@@ -4,6 +4,7 @@
 #[derive(Debug)]
 pub enum WarningKind {
     DeprecatedLiteralURL,
+    UselessInherit,
 }
 
 #[derive(Debug)]