diff options
author | Vincent Ambo <mail@tazj.in> | 2022-08-27T14·16+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-09-04T17·40+0000 |
commit | a52db148203824484caa82a23fe88f0a137274ee (patch) | |
tree | 9f8d66d36b5e792add5961e99b65dacf268e1cb0 /tvix/eval/src/errors.rs | |
parent | 00aeb6dfaf97c515b155387fc7de27429cf86f74 (diff) |
feat(tvix/eval): detect illegally shadowed variables r/4637
Nix does not allow things like `let a = 1; a = 2; in a`, but doing it across depths is allowed. Change-Id: I6a259f8b01a254b433b58c736e245c9c764641b6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6301 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src/errors.rs')
-rw-r--r-- | tvix/eval/src/errors.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tvix/eval/src/errors.rs b/tvix/eval/src/errors.rs index 96217cabaf4b..49a051c16eee 100644 --- a/tvix/eval/src/errors.rs +++ b/tvix/eval/src/errors.rs @@ -32,6 +32,9 @@ pub enum ErrorKind { // Unknown variable in dynamic scope (with, rec, ...). UnknownDynamicVariable(String), + // User is defining the same variable twice at the same depth. + VariableAlreadyDefined(String), + // Attempt to call something that is not callable. NotCallable, |