Synthetica9 / nix-linter

Linter for the Nix expression language
BSD 3-Clause "New" or "Revised" License
158 stars 16 forks source link

False positive UnusedLetBind in the presence of `inherit` #61

Open whentze opened 2 years ago

whentze commented 2 years ago

Issue

This input:

let
  foo = { bar = ""; };
  inherit (foo) bar;
in
  bar

results in this lint:

Unused `let` bind `foo` at linter-repro.nix:2:3

However, removing the let-binding (unsurprisingly) breaks the inherit.

Affected Versions

I tested this on current git master (ecdd50750fd3ffaff83c0637474b884a0c38f8b9) and the version available in nixpkgs 21.05 (2516a8cda41f9bb553a1c3eca38e3dd94ebf53de).