diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2022-04-10 16:37:16 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-05-23 21:04:49 -0400 |
commit | e9fff12b34bb9770491d24eff5c280f44dc8cfc1 (patch) | |
tree | 13007782780918e0b69f27d1157a3d4d487997d1 /compiler/GHC/Parser | |
parent | 1a4195b04866ebdb5f42006fb92b8a73a4aa2bac (diff) | |
download | haskell-e9fff12b34bb9770491d24eff5c280f44dc8cfc1.tar.gz |
EPA : Remove duplicate comments in DataFamInstD
The code
data instance Method PGMigration = MigrationQuery Query
-- ^ Run a query against the database
| MigrationCode (Connection -> IO (Either String ()))
-- ^ Run any arbitrary IO code
Resulted in two instances of the "-- ^ Run a query against the database"
comment appearing in the Exact Print Annotations when it was parsed.
Ensure only one is kept.
Closes #20239
Diffstat (limited to 'compiler/GHC/Parser')
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 22 | ||||
-rw-r--r-- | compiler/GHC/Parser/PostProcess/Haddock.hs | 2 |
2 files changed, 20 insertions, 4 deletions
diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index 845f7eb25c..17ea462f24 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -324,16 +324,32 @@ mkDataFamInst loc new_or_data cType (mcxt, bndrs, tycl_hdr) ksig data_cons (L _ maybe_deriv) anns = do { (tc, tparams, fixity, ann) <- checkTyClHdr False tycl_hdr ; cs <- getCommentsFor loc -- Add any API Annotations to the top SrcSpan - ; let anns' = addAnns (EpAnn (spanAsAnchor loc) ann cs) anns emptyComments + ; let fam_eqn_ans = addAnns (EpAnn (spanAsAnchor loc) ann cs) anns emptyComments ; defn <- mkDataDefn new_or_data cType mcxt ksig data_cons maybe_deriv - ; return (L (noAnnSrcSpan loc) (DataFamInstD anns' (DataFamInstDecl - (FamEqn { feqn_ext = anns' + ; return (L (noAnnSrcSpan loc) (DataFamInstD noExtField (DataFamInstDecl + (FamEqn { feqn_ext = fam_eqn_ans , feqn_tycon = tc , feqn_bndrs = bndrs , feqn_pats = tparams , feqn_fixity = fixity , feqn_rhs = defn })))) } +-- mkDataFamInst loc new_or_data cType (mcxt, bndrs, tycl_hdr) +-- ksig data_cons (L _ maybe_deriv) anns +-- = do { (tc, tparams, fixity, ann) <- checkTyClHdr False tycl_hdr +-- ; cs <- getCommentsFor loc -- Add any API Annotations to the top SrcSpan +-- ; let anns' = addAnns (EpAnn (spanAsAnchor loc) ann cs) anns emptyComments +-- ; defn <- mkDataDefn new_or_data cType mcxt ksig data_cons maybe_deriv +-- ; return (L (noAnnSrcSpan loc) (DataFamInstD anns' (DataFamInstDecl +-- (FamEqn { feqn_ext = anns' +-- , feqn_tycon = tc +-- , feqn_bndrs = bndrs +-- , feqn_pats = tparams +-- , feqn_fixity = fixity +-- , feqn_rhs = defn })))) } + + + mkTyFamInst :: SrcSpan -> TyFamInstEqn GhcPs -> [AddEpAnn] diff --git a/compiler/GHC/Parser/PostProcess/Haddock.hs b/compiler/GHC/Parser/PostProcess/Haddock.hs index 72403ef018..ea9118a525 100644 --- a/compiler/GHC/Parser/PostProcess/Haddock.hs +++ b/compiler/GHC/Parser/PostProcess/Haddock.hs @@ -1511,7 +1511,7 @@ flattenBindsAndSigs (all_bs, all_ss, all_ts, all_tfis, all_dfis, all_docs) = mapLL (\s -> SigD noExtField s) all_ss, mapLL (\t -> TyClD noExtField (FamDecl noExtField t)) all_ts, mapLL (\tfi -> InstD noExtField (TyFamInstD noExtField tfi)) all_tfis, - mapLL (\dfi -> InstD noExtField (DataFamInstD noAnn dfi)) all_dfis, + mapLL (\dfi -> InstD noExtField (DataFamInstD noExtField dfi)) all_dfis, mapLL (\d -> DocD noExtField d) all_docs ] |