fix error when exporting constants with type signatures in modules#14118
Merged
sholderbach merged 1 commit intonushell:mainfrom Oct 22, 2024
sgvictorino:fix-module-export-const
Merged
fix error when exporting constants with type signatures in modules#14118sholderbach merged 1 commit intonushell:mainfrom sgvictorino:fix-module-export-const
sholderbach merged 1 commit intonushell:mainfrom
sgvictorino:fix-module-export-const
Conversation
sholderbach
reviewed
Oct 18, 2024
sholderbach
reviewed
Oct 21, 2024
Member
sholderbach
left a comment
There was a problem hiding this comment.
Thanks for reworking this. Looks good to me and great additional test on the special name detection.
Comment on lines
+3132
to
+3133
| let name_span = Span::new(name_span.start, name_span.end - 1); | ||
| let var_name = bytes[0..(bytes.len() - 1)].to_vec(); |
Member
There was a problem hiding this comment.
Nice that gets more explicit!
# 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14023
Description
with type signatures:
name_is_builtin_varerrors for names with type signatures: