ghc-exactprint 1.6.1.2 → 1.6.1.3
raw patch · 5 files changed
+13/−11 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog +2/−0
- ghc-exactprint.cabal +1/−1
- src/Language/Haskell/GHC/ExactPrint/ExactPrint.hs +3/−6
- src/Language/Haskell/GHC/ExactPrint/Utils.hs +6/−3
- tests/examples/ghc94/Haddock.hs +1/−1
ChangeLog view
@@ -1,3 +1,5 @@+2023-06-04 v1.6.1.3+ * Fix support for exact printing when using GHC option --haddock #125 2023-05-31 v1.6.1.2 * Add GHC 9.4.5 to CI * Add support for exact printing when using GHC option --haddock #125
ghc-exactprint.cabal view
@@ -1,5 +1,5 @@ name: ghc-exactprint-version: 1.6.1.2+version: 1.6.1.3 synopsis: ExactPrint for GHC description: Using the API Annotations available from GHC 9.2.1, this library provides a means to round trip any code that can
src/Language/Haskell/GHC/ExactPrint/ExactPrint.hs view
@@ -4271,7 +4271,6 @@ , con_mb_cxt = mcxt , con_args = args , con_doc = doc }) = do- doc' <- mapM markAnnotated doc an0 <- if has_forall then markEpAnnL an lidl AnnForall else return an@@ -4291,7 +4290,7 @@ , con_ex_tvs = ex_tvs' , con_mb_cxt = mcxt' , con_args = args'- , con_doc = doc' })+ , con_doc = doc }) where -- -- In ppr_details: let's not print the multiplicities (they are always 1, by@@ -4318,7 +4317,6 @@ , con_bndrs = bndrs , con_mb_cxt = mcxt, con_g_args = args , con_res_ty = res_ty, con_doc = doc }) = do- doc' <- mapM markAnnotated doc cons' <- mapM markAnnotated cons an0 <- markEpAnnL an lidl AnnDcolon an1 <- annotationsToComments an0 lidl [AnnOpenP, AnnCloseP]@@ -4346,7 +4344,7 @@ , con_names = cons' , con_bndrs = bndrs' , con_mb_cxt = mcxt', con_g_args = args'- , con_res_ty = res_ty', con_doc = doc' })+ , con_res_ty = res_ty', con_doc = doc }) -- --------------------------------------------------------------------- @@ -4382,8 +4380,7 @@ names' <- markAnnotated names an0 <- markEpAnnL an lidl AnnDcolon ftype' <- markAnnotated ftype- mdoc' <- mapM markAnnotated mdoc- return (ConDeclField an0 names' ftype' mdoc')+ return (ConDeclField an0 names' ftype' mdoc) -- ---------------------------------------------------------------------
src/Language/Haskell/GHC/ExactPrint/Utils.hs view
@@ -215,13 +215,16 @@ hsDocStringComments :: Anchor -> RealSrcSpan -> GHC.HsDocString -> [Comment] hsDocStringComments _ pt (MultiLineDocString dec (x :| xs)) = let- L lx x' = dedentDocChunkBy 4 x- str = "-- " ++ printDecorator dec ++ unpackHDSC x'+ decStr = printDecorator dec+ L lx x' = dedentDocChunkBy (3 + length decStr) x+ str = "-- " ++ decStr ++ unpackHDSC x' docChunk _ [] = [] docChunk pt' (L l chunk:cs) = Comment ("--" ++ unpackHDSC chunk) (spanAsAnchor l) pt' Nothing : docChunk (rs l) cs in- (Comment str (spanAsAnchor lx) pt Nothing : docChunk pt (map dedentDocChunk xs))+ (Comment str (spanAsAnchor lx) pt Nothing : docChunk (rs lx) (map dedentDocChunk xs))+hsDocStringComments anc pt (NestedDocString dec@(HsDocStringNamed _) (L _ chunk))+ = [Comment ("{- " ++ printDecorator dec ++ unpackHDSC chunk ++ "-}") anc pt Nothing ] hsDocStringComments anc pt (NestedDocString dec (L _ chunk)) = [Comment ("{-" ++ printDecorator dec ++ unpackHDSC chunk ++ "-}") anc pt Nothing ] hsDocStringComments _ _ (GeneratedDocString _) = [] -- Should not appear in user-written code
tests/examples/ghc94/Haddock.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+{-# OPTIONS_GHC -fno-warn-redundant-constraints -haddock #-} ----------------------------------------------------------------------------- -- | -- Module : Test