-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
else if
causes unhelpful parsing error in 0.73.0 when condition has an issue
#7575
Comments
Same here but I can't seem to be able to debug it on my side. |
For the record, when I was trouble shooting this, the problem ended up being that parts of the script were using out of date syntax which manifested in an odd and unhelpful error. So, if you have this problem, I'd first check your script for syntax issues. Having said that, we should have more helpful errors. It seems like someone may have tracked a bug down too relating to this, such as a match block in the source code not having all the proper arms that it needed. I'm not sure where that is. You may be able to find that by following the original thread on discord here https://discord.com/channels/601130461678272522/614593951969574961/1055605163328536687. |
This was it!
|
…8274) # Description Fixes: #7575 # User-Facing Changes Previously: ``` if❯ if false { "aaa" } else if $a { 'a' } Error: nu::parser::parse_mismatch × Parse mismatch during operation. ╭─[entry #10:1:1] 1 │ if false { "aaa" } else if $a { 'a' } · ─┬ · ╰── expected block, closure or record ╰──── ``` After: ``` ❯ if false { "aaa" } else if $a { 'a' } Error: nu::parser::variable_not_found × Variable not found. ╭─[entry #1:1:1] 1 │ if false { "aaa" } else if $a { 'a' } · ─┬ · ╰── variable not found ╰──── ``` # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date.
Describe the bug
Nu 0.73.0 needs an improved error message when parsing
if-else-if
. See also Discord help chat on 22 Dec 2022.How to reproduce
Expected behavior
If a syntax error prevents parsing of the
if-else
, surfacing that error is necessary to resolve any issues. This is particularly true when we encounter breaking changes on upgrade.Screenshots
No response
Configuration
Additional context
No response
The text was updated successfully, but these errors were encountered: