nixfmt icon indicating copy to clipboard operation
nixfmt copied to clipboard

Quotes should be allowed after `inherit`

Open nagy opened this issue 2 years ago • 1 comments

Consider this default.nix file:

rec {
  first."hello/there" = 123;
  second = { inherit (first) "hello/there"; };
}

It is valid:

$ nix-instantiate --eval default.nix -A second.hello/there
123

But with nixfmt, I get:

$ nixfmt default.nix
default.nix:3:30:
  |
3 |   second = { inherit (first) "hello/there"; };
  |                              ^
unexpected '"'
expecting expression

nagy avatar Apr 17 '22 22:04 nagy

I have found a very similar issue to this one. Dollar-sign after inherit:

rec {
  first.${"hello"} = 123;
  second = { inherit (first) ${"hello"}; };
}
$ nixfmt default.nix
default.nix:3:30:
  |
3 |   second = { inherit (first) ${"hello"}; };
  |                              ^
unexpected '$'
expecting expression

nagy avatar Apr 29 '22 18:04 nagy

Another example:

rec {
  first."hello.there" = 123;
  second = { inherit (first) "hello.there"; };
}
default.nix:3:30:
  |
3 |   second = { inherit (first) "hello.there"; };
  |                              ^
unexpected '"'
expecting expression

Enzime avatar May 29 '23 09:05 Enzime