mirror of
https://github.com/nushell/nushell.git
synced 2025-08-02 19:59:23 +02:00
fix error when exporting consts with type signatures in modules (#14118)
Fixes #14023 # Description - Prevents "failed to find added variable" when modules export constants with type signatures: ```nushell > module foo { export const bar: int = 2 } Error: nu::parser::unknown_state × Internal error. ╭─[entry #1:1:21] 1 │ module foo { export const bar: int = 2 } · ─────────┬──────── · ╰── failed to find added variable ``` - Returns `name_is_builtin_var` errors for names with type signatures: ```nushell > let env: string = ""; Error: nu::parser::name_is_builtin_var × `env` used as variable name. ╭─[entry #1:1:5] 1 │ let env: string = ""; · ─┬─ · ╰── already a builtin variable ```
This commit is contained in:
@ -117,6 +117,10 @@ fn export_consts() -> TestResult {
|
||||
run_test(
|
||||
r#"module spam { export const b = 3; }; use spam b; $b"#,
|
||||
"3",
|
||||
)?;
|
||||
run_test(
|
||||
r#"module spam { export const b: int = 3; }; use spam b; $b"#,
|
||||
"3",
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user