Skip to content

else if causes unhelpful parsing error in 0.73.0 when condition has an issue #7575

@deoradh

Description

@deoradh

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

〉 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.

Screenshots

No response

Configuration

key value
version 0.73.0
branch
commit_hash
build_os macos-aarch64
build_target aarch64-apple-darwin
rust_version rustc 1.66.0 (69f9c33d7 2022-12-12)
rust_channel stable-aarch64-apple-darwin
cargo_version cargo 1.66.0 (d65d197ad 2022-11-15)
pkg_version 0.73.0
build_time 2022-12-21 16:19:51 -08:00
build_rust_channel release
features database, default, trash, which, zip
installed_plugins query, query json, query web, query xml

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:error-unhelpfulThe error message you observe is not helpful to identify the problemA:parserIssues related to parsing

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions