You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
else if causes unhelpful parsing error in 0.73.0 when condition has an issue #7575
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
〉 if true { 'one' } else if $a { 'two' } else if $a { 'three' }
Error: nu::parser::parser_incomplete (link)
× Parser incomplete.
╭─[entry #3:1:1]
1 │ if true { 'one' } else if $a { 'two' } else if $a { 'three' }
· ─┬
· ╰── parser support missing for this expression
╰────
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.
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.
Activity
melMass commentedon Dec 30, 2022
Same here but I can't seem to be able to debug it on my side.
fdncred commentedon Dec 30, 2022
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.
melMass commentedon Dec 30, 2022
This was it!
glcraft commentedon Feb 22, 2023
I also reproduced this issue in my code

make `else if` generate helpful error when condition have an issue (#…