Skip to content

Edge case of where command #177

@blindFS

Description

@blindFS

The following code is valid in nu but causes error in tree-sitter-nu

[{a: {b: true}}, {a: {d: false}}] | where a?.b?

However the following code is not allowed in nushell

[{a: {b: true}}, {a: {d: false}}] | where a?.b? and a?.b?
Error: nu::shell::type_mismatch

  × Type mismatch.
   ╭─[entry #38:1:46]
 1 │ [{a: {b: true}}, {a: {d: false}}] | where a?.b? and a?.b?
   ·                                              ┬
   ·                                              ╰── expected bool
   ╰────

So which of the following way is suggested for its fix in tree-sitter-nu:

  1. special treatment to make only the first case valid
  2. allow both

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions