From 1cb19314069a74d526165a53d56bac5dfb3f9c9c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 13 Aug 2022 21:52:44 +0300 Subject: feat(tvix/eval): emit warnings on useless inherit Change-Id: Ifb9993cf8b85393eb43e1b204c7ab2f889b7113b Reviewed-on: https://cl.tvl.fyi/c/depot/+/6194 Tested-by: BuildkiteCI Reviewed-by: sterni --- tvix/eval/src/compiler.rs | 9 ++++++++- tvix/eval/src/warnings.rs | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tvix/eval/src/compiler.rs b/tvix/eval/src/compiler.rs index e2d194e8dd..75ea99ea78 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 44e47793c5..953f93ff46 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)] -- cgit 1.4.1