mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 00:56:01 +02:00
add dedicated const in pipeline
, const builtin var
errors (#7784)
# Description Currently `let` and `const` share error handling, and this might lead to confusing error messages  This PR adds dedicated errors to `const`
This commit is contained in:
@@ -2842,8 +2842,11 @@ pub fn parse_let_or_const(
|
||||
.to_string();
|
||||
|
||||
if ["in", "nu", "env", "nothing"].contains(&var_name.as_str()) {
|
||||
error =
|
||||
error.or(Some(ParseError::LetBuiltinVar(var_name, lvalue.span)));
|
||||
error = if is_const {
|
||||
error.or(Some(ParseError::ConstBuiltinVar(var_name, lvalue.span)))
|
||||
} else {
|
||||
error.or(Some(ParseError::LetBuiltinVar(var_name, lvalue.span)))
|
||||
};
|
||||
}
|
||||
|
||||
let var_id = lvalue.as_var();
|
||||
|
Reference in New Issue
Block a user