70a80d62

Created Cancelled

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.
GitHub