feat(tvix/eval): emit warnings when globals are being shadowed
Change-Id: I7dae6978c2a4548382d7fa059b20ccdf35d2cf7f Reviewed-on: https://cl.tvl.fyi/c/depot/+/6257 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
b41960c55e
commit
07fcaf034b
2 changed files with 2 additions and 0 deletions
|
@ -900,6 +900,7 @@ impl Compiler {
|
|||
};
|
||||
|
||||
if let Some(global_ident) = key {
|
||||
self.emit_warning(node.clone(), WarningKind::ShadowedGlobal(global_ident));
|
||||
self.scope_mut().poison(global_ident, depth);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ pub enum WarningKind {
|
|||
DeprecatedLiteralURL,
|
||||
UselessInherit,
|
||||
UnusedBinding,
|
||||
ShadowedGlobal(&'static str),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
Loading…
Reference in a new issue