diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2021-10-28 19:05:51 +0100 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2021-11-02 21:39:32 +0000 |
commit | 39eed84c2188b15ed312b4468f1a44c6a49fb268 (patch) | |
tree | 0db2b8b53a33d4f61c273504b5665ba333474476 /compiler/GHC/Parser/PostProcess | |
parent | a7e1be3d84d2b7d0515f909175cdfa5dcf0dc55c (diff) | |
download | haskell-39eed84c2188b15ed312b4468f1a44c6a49fb268.tar.gz |
EPA: Get rid of bare SrcSpan's in the ParsedSource
The ghc-exactPrint library has had to re-introduce the relatavise
phase.
This is needed if you change the length of an identifier and want the
layout to be preserved afterwards.
It is not possible to relatavise a bare SrcSpan, so introduce `SrcAnn
NoEpAnns` for them instead.
Updates haddock submodule.
Diffstat (limited to 'compiler/GHC/Parser/PostProcess')
-rw-r--r-- | compiler/GHC/Parser/PostProcess/Haddock.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/GHC/Parser/PostProcess/Haddock.hs b/compiler/GHC/Parser/PostProcess/Haddock.hs index f0adba4e6f..540a807428 100644 --- a/compiler/GHC/Parser/PostProcess/Haddock.hs +++ b/compiler/GHC/Parser/PostProcess/Haddock.hs @@ -592,7 +592,7 @@ instance HasHaddock (HsDataDefn GhcPs) where -- Process the deriving clauses of a data/newtype declaration. -- Not used for standalone deriving. -instance HasHaddock (Located [Located (HsDerivingClause GhcPs)]) where +instance HasHaddock (Located [LocatedAn NoEpAnns (HsDerivingClause GhcPs)]) where addHaddock lderivs = extendHdkA (getLoc lderivs) $ traverse @Located addHaddock lderivs @@ -604,10 +604,10 @@ instance HasHaddock (Located [Located (HsDerivingClause GhcPs)]) where -- deriving (Ord {- ^ Comment on Ord N -}) via Down N -- -- Not used for standalone deriving. -instance HasHaddock (Located (HsDerivingClause GhcPs)) where +instance HasHaddock (LocatedAn NoEpAnns (HsDerivingClause GhcPs)) where addHaddock lderiv = - extendHdkA (getLoc lderiv) $ - for @Located lderiv $ \deriv -> + extendHdkA (getLocA lderiv) $ + for @(LocatedAn NoEpAnns) lderiv $ \deriv -> case deriv of HsDerivingClause { deriv_clause_ext, deriv_clause_strategy, deriv_clause_tys } -> do let @@ -620,8 +620,8 @@ instance HasHaddock (Located (HsDerivingClause GhcPs)) where (register_strategy_before, register_strategy_after) = case deriv_clause_strategy of Nothing -> (pure (), pure ()) - Just (L l (ViaStrategy _)) -> (pure (), registerLocHdkA l) - Just (L l _) -> (registerLocHdkA l, pure ()) + Just (L l (ViaStrategy _)) -> (pure (), registerLocHdkA (locA l)) + Just (L l _) -> (registerLocHdkA (locA l), pure ()) register_strategy_before deriv_clause_tys' <- addHaddock deriv_clause_tys register_strategy_after |