diff options
-rw-r--r-- | tvix/eval/src/compiler/bindings.rs | 3 | ||||
-rw-r--r-- | tvix/eval/src/warnings.rs | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/tvix/eval/src/compiler/bindings.rs b/tvix/eval/src/compiler/bindings.rs index 83667c129be0..682cf134ce1a 100644 --- a/tvix/eval/src/compiler/bindings.rs +++ b/tvix/eval/src/compiler/bindings.rs @@ -647,6 +647,9 @@ impl Compiler<'_> { self.emit_constant(Value::Attrs(Box::new(NixAttrs::empty())), node); return; } + + self.emit_warning(node, WarningKind::EmptyLet); + return; } // Actually bind values and ensure they are on the stack. diff --git a/tvix/eval/src/warnings.rs b/tvix/eval/src/warnings.rs index 9ebf182f975d..cfe5044a8cbe 100644 --- a/tvix/eval/src/warnings.rs +++ b/tvix/eval/src/warnings.rs @@ -16,6 +16,7 @@ pub enum WarningKind { UselessBoolOperation(&'static str), DeadCode, EmptyInherit, + EmptyLet, /// Tvix internal warning for features triggered by users that are /// not actually implemented yet, but do not cause runtime failures. @@ -66,7 +67,7 @@ impl EvalWarning { } WarningKind::UselessInherit => { - "inherited variable already exists with the same value".to_string() + format!("inherit does nothing (this variable already exists with the same value)") } WarningKind::UnusedBinding => { @@ -100,6 +101,10 @@ impl EvalWarning { format!("this `inherit` statement is empty") } + WarningKind::EmptyLet => { + format!("this `let`-expression contains no bindings") + } + WarningKind::NotImplemented(what) => { format!("feature not yet implemented in tvix: {}", what) } @@ -119,6 +124,7 @@ impl EvalWarning { WarningKind::UselessBoolOperation(_) => "W007", WarningKind::DeadCode => "W008", WarningKind::EmptyInherit => "W009", + WarningKind::EmptyLet => "W010", WarningKind::NotImplemented(_) => "W999", } |