oppiliappan / statix

lints and suggestions for the nix programming language
https://git.peppe.rs/languages/statix/about
MIT License
552 stars 21 forks source link

Wrong path parsing #68

Open selfuryon opened 1 year ago

selfuryon commented 1 year ago

Hello! If I have this attrset:

rec {
  name = "test";
  path = ./new/${name}.nix;
}

Statix can't parse it correctly:

 $ statix check test.nix
[bin/src/config.rs:79] [self.ignore.as_slice(), extra_ignores].concat() = []
[E00] Error: Syntax error
   ╭─[test.nix:3:24]
   │
 3 │ ╭─▶   path = ./new/${name}.nix;
 4 │ ├─▶ }
   · │
   · ╰─────── Unexpected TOKEN_PATH at 46..52, wanted any of [TOKEN_IDENT]
───╯
[E00] Error: Syntax error
   ╭─[test.nix:1:1]
   │
 1 │ rec {
   · │
   · ╰─ Unexpected end of file, wanted any of [TOKEN_IDENT]
───╯
[E00] Error: Syntax error
   ╭─[test.nix:1:1]
   │
 1 │ rec {
   · │
   · ╰─ Unexpected end of file, wanted any of [TOKEN_SEMICOLON]
───╯
[E00] Error: Syntax error
   ╭─[test.nix:1:1]
   │
 1 │ rec {
   · │
   · ╰─ Unexpected end of file

It seems like it doesn't work with ., because if I omit that it works fine. All of these variants works:

rec {
  name = "test";
  path1 = ./new/${name}nix;
  path2 = ./new/${name}/nix;
  path3 = ./new/${name}/test.nix;
}