mirror of
https://github.com/nushell/nushell.git
synced 2025-08-15 21:37:53 +02:00
fix(parser): namespace pollution of constants by use module.nu
(#15518)
A bug introduced by #14920 When `use module.nu` is called, all exported constants defined in it are added to the scope. # Description On the branch of empty arguments, the constant var_id vector should be empty, only constant_values (for `$module.foo` access) are injected. # User-Facing Changes # Tests + Formatting ~todo!~ adjusted # After Submitting
This commit is contained in:
@ -143,6 +143,10 @@ fn export_module_which_defined_const() -> TestResult {
|
||||
run_test(
|
||||
r#"module spam { export const b = 3; export const c = 4 }; use spam; $spam.b + $spam.c"#,
|
||||
"7",
|
||||
)?;
|
||||
fail_test(
|
||||
r#"module spam { export const b = 3; export const c = 4 }; use spam; $b"#,
|
||||
"variable not found",
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user