From 4e98730f3809e92bc527dac7c7b7928cf311b0ca Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 5 Jan 2023 15:32:14 +0300 Subject: feat(tvix/eval): warn about empty `inherit`s Change-Id: I82bec6fe2210bcb88c46fd2fdf3e26bd613d1c1f Reviewed-on: https://cl.tvl.fyi/c/depot/+/7768 Reviewed-by: flokli Reviewed-by: raitobezarius Tested-by: BuildkiteCI --- tvix/eval/src/compiler/bindings.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tvix/eval/src/compiler') diff --git a/tvix/eval/src/compiler/bindings.rs b/tvix/eval/src/compiler/bindings.rs index 9d4269002369..93b3dc3cc666 100644 --- a/tvix/eval/src/compiler/bindings.rs +++ b/tvix/eval/src/compiler/bindings.rs @@ -321,6 +321,11 @@ impl Compiler<'_> { let mut inherit_froms: Vec<(ast::Expr, SmolStr, Span)> = vec![]; for inherit in node.inherits() { + if inherit.attrs().peekable().peek().is_none() { + self.emit_warning(&inherit, WarningKind::EmptyInherit); + continue; + } + match inherit.from() { // Within a `let` binding, inheriting from the outer scope is a // no-op *if* there are no dynamic bindings. -- cgit 1.4.1