Skip to content

Handle local fixity declarations in DsMeta properly

Ryan Scott requested to merge wip/T17608 into master

DsMeta.rep_sig used to skip over FixSig entirely, which had the effect of causing local fixity declarations to be dropped when quoted in Template Haskell. But there is no good reason for this state of affairs, as the code in DsMeta.repFixD (which handles top-level fixity declarations) handles local fixity declarations just fine. This patch factors out the necessary parts of repFixD so that they can be used in rep_sig as well.

There was one minor complication: the fixity signatures for class methods in each HsGroup were stored both in FixSigs and the list of LFixitySigs for top-level fixity signatures, so I needed to take action to prevent fixity signatures for class methods being converted to Decs twice. I tweaked RnSource.add to avoid putting these fixity signatures in two places and added Note [Top-level fixity signatures in an HsGroup] in GHC.Hs.Decls to explain the new design.

Fixes #17608 (closed). Bumps the Haddock submodule.

Edited by Ryan Scott

Merge request reports