Fixed the panic when type a statement similar to let f = 'f' $ in the nushell#9851
Merged
sophiajt merged 3 commits intonushell:mainfrom Aug 1, 2023
mengsuenyan:fix/9826
Merged
Fixed the panic when type a statement similar to let f = 'f' $ in the nushell#9851sophiajt merged 3 commits intonushell:mainfrom mengsuenyan:fix/9826
let f = 'f' $ in the nushell#9851sophiajt merged 3 commits intonushell:mainfrom
mengsuenyan:fix/9826
Conversation
let f = 'f' $ in the nushell
let f = 'f' $ in the nushelllet f = 'f' $ in the nushell
let f = 'f' $ in the nushelllet f = 'f' $ in the nushell
Contributor
|
Can you add tests to this to ensure it's working? |
…' $` in the nushell;
Contributor
|
thanks! |
This was referenced Sep 15, 2023
WindSoilder
pushed a commit
that referenced
this pull request
Sep 27, 2024
# Description Old code was comparing remaining positional arguments with total number of arguments, where it should've compared remaining positional with with remaining arguments of any kind. This means that if a function was given too few arguments, `calculate_end_span` would believe that it actually had too many arguments, since after parsing the first few arguments, the number of remaining arguments needed were fewer than the *total* number of arguments, of which we had used several. Fixes #9072 Fixes: #13930 Fixes: #12069 Fixes: #8385 Extracted from #10381 ## Bonus It also improves the error handling on missing positional arguments before keywords (no longer crashing since #9851). Instead of just giving the keyword to the parser for the missing positional, we give an explicit error about a missing positional argument. I would like better descriptions than "missing var_name" though, but I'm not sure if that's available without Old error ``` Error: nu::parser::parse_mismatch × Parse mismatch during operation. ╭─[entry #1:1:1] 1 │ let = if foo · ┬ · ╰── expected valid variable name ╰──── ``` New error ``` Error: nu::parser::missing_positional × Missing required positional argument. ╭─[entry #18:1:1] 1 │ let = foo · ┬ · ╰── missing var_name ╰──── help: Usage: let <var_name> = <initial_value> ``` # User-Facing Changes The program `alias = = =` is no longer accepted by the parser
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.
let = if $#9596let = if $#9596fixed the following bugs: