statix icon indicating copy to clipboard operation
statix copied to clipboard

false positive for useless_parens with a value called `or`

Open maralorn opened this issue 3 years ago • 0 comments

I have a fun one. A situation where the useless_parens lint is triggered, although removing the parentheses changes the semantics.

Consider

(builtins.foldl') or "false" list_of_something_boolish

where or is a not a keyword but a regular function from my code. This is not equivalent to

builtins.foldl' or "false" list_of_something_boolish

where or is part of the . operator. (compare first entry in this list: https://nixos.org/manual/nix/stable/expressions/language-operators.html)

I admit this is a bit esoteric, but this was the easiest way not have the or interpreted as the operator and the false positive warning happened to me without searching for it.

maralorn avatar Mar 11 '22 00:03 maralorn