-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Exported constants in modules with a dash in the name aren't accessible #14252
Copy link
Copy link
Closed
Labels
A:scoping/name-resolutionHow Nu finds which variables/functions are in scope and to what they are boundHow Nu finds which variables/functions are in scope and to what they are boundcategory:bugSomething isn't workingSomething isn't workingstatus:needs-triageAn issue that hasn't had any proper lookAn issue that hasn't had any proper look
Milestone
Description
Describe the bug
If a module has a dash in its name, and it exports a constant, it's not possible to access the constant when importing the entire module.
How to reproduce
> module foo-bar { export const VALUE = 123 }
> use foo-bar
> $foo_bar.VALUE
Error: nu::parser::variable_not_found
× Variable not found.
╭─[entry #9:1:1]
1 │ $foo_bar.VALUE
· ────┬───
· ╰── variable not found. Did you mean '$foo-bar'?
╰────
> $foo-bar.VALUE
Error: nu::parser::parse_mismatch
× Parse mismatch during operation.
╭─[entry #10:1:1]
1 │ $foo-bar.VALUE
· ────┬───
· ╰── expected valid variable name
╰────Expected behavior
I expected to be able to access the constant with $foo_bar.VALUE.
Configuration
| key | value |
|---|---|
| version | 0.99.2 |
| major | 0 |
| minor | 99 |
| patch | 2 |
| branch | makepkg |
| commit_hash | 8b19399 |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.80.1 (3f5fd8dd4 2024-08-06) |
| rust_channel | 1.80.1-x86_64-unknown-linux-gnu |
| cargo_version | cargo 1.80.1 (376290515 2024-07-16) |
| build_time | 2024-11-04 09:00:06 +00:00 |
| build_rust_channel | release |
| allocator | mimalloc |
| features | default, sqlite, trash |
| installed_plugins | custom_values 0.1.0, example 0.98.0, explore 0.99.1, formats 0.98.0, gstat 0.98.0, inc 0.98.0, jwalk 0.8.0, polars 0.98.0, query 0.98.0, stress_internals 0.98.0 |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A:scoping/name-resolutionHow Nu finds which variables/functions are in scope and to what they are boundHow Nu finds which variables/functions are in scope and to what they are boundcategory:bugSomething isn't workingSomething isn't workingstatus:needs-triageAn issue that hasn't had any proper lookAn issue that hasn't had any proper look