feat(tvix/eval): skip & warn for useless parenthesis

Change-Id: I567ca0682012b9d09f1217e57a104ac5671f8d82
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7771
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Vincent Ambo 2023-01-05 16:16:35 +03:00 committed by tazjin
parent aadf71a6ed
commit 87c80895cd
2 changed files with 32 additions and 0 deletions

View file

@ -17,6 +17,7 @@ pub enum WarningKind {
DeadCode,
EmptyInherit,
EmptyLet,
UselessParens,
/// Tvix internal warning for features triggered by users that are
/// not actually implemented yet, but do not cause runtime failures.
@ -105,6 +106,10 @@ impl EvalWarning {
format!("this `let`-expression contains no bindings")
}
WarningKind::UselessParens => {
format!("these parenthesis can be removed")
}
WarningKind::NotImplemented(what) => {
format!("feature not yet implemented in tvix: {}", what)
}
@ -125,6 +130,7 @@ impl EvalWarning {
WarningKind::DeadCode => "W008",
WarningKind::EmptyInherit => "W009",
WarningKind::EmptyLet => "W010",
WarningKind::UselessParens => "W011",
WarningKind::NotImplemented(_) => "W999",
}