Skip to content

Chained has attribute treated as invalid syntax #359

@musjj

Description

@musjj

The has attribute can be chained:

$ nix eval --expr "{} ? foo ? bar"
false

But nixfmt fails to format it:

$ nixfmt <<<"{} ? foo ? bar"
<stdin>:1:10:
  |
1 | {} ? foo ? bar
  |          ^
unexpected '?'
expecting '.', end of input, or operator

Meanwhile, single has attributes or dot operators work just fine:

$ nixfmt <<<"{} ? foo"
{ } ? foo

$ nixfmt <<<"{} ? foo.bar"
{ } ? foo.bar

Metadata

Metadata

Assignees

No one assigned

    Labels

    correctnessOutput parses differently after formatting
    No fields configured for issues without a type.

    Projects

    Status

    Approved

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions