70a80d62

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

Attach a comment above an ANN pragma to the definition under it

GHC parses {-# ANN foo ... #-} as a declaration, so it was the next declaration
a comment above one attached to, and that declaration carried the name
"declaration", which nothing else in the module answers to. A comment's scope
is what a suppression is matched against, so an [allow:...] written there
matched no finding and was reported unused, and a tag or a ref there connected
nothing.

An annotation is not a subject, so it gets its own DeclKind and attachment
steps over it. Naming it after what it annotates was the first attempt and is
kept, but not for attachment: a name occurrence inside the pragma is scoped by
it, and a suppression for such a finding has to be writable where the hint says
to write it. Naming alone would have attached a comment above
{-# ANN foo #-} bar to foo, which is worse than the empty scope it replaced.
e2e-added-rule-is-rune2e-artifacts-are-reade2e-choices-are-found-beside-the-repositorye2e-cleane2e-dirty-package-is-judged-failinge2e-dirty-project-is-judged-failinge2e-dirty-report-is-readablee2e-disabled-rule-is-not-rune2e-incomplete-artifacts-are-a-failuree2e-judging-nothing-failse2e-named-packages-are-every-packagee2e-no-packages-is-judged-failinge2e-no-store-paths-in-findingse2e-paths-are-repository-relativee2e-withheld-facts-faile2e-wrong-source-mapping-is-a-complainthlint-checkhopinionpre-commitreleaseshellweeder-checkconfiguredevShelldefaultx86_64-linux