diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2022-12-04 17:11:01 +0300 |
---|---|---|
committer | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2022-12-04 20:04:07 +0300 |
commit | 7515ec98a5a04603ac366c8802ac8af813a74304 (patch) | |
tree | 1e18237d3ae2f72aedb0e638d7ed8c4c2ce9cc55 | |
parent | 6a66da29ab0f3cd9d1942189edffcf75952d9597 (diff) | |
download | haskell-7515ec98a5a04603ac366c8802ac8af813a74304.tar.gz |
WIP: Use LHsToken for class, where
Updates the haddock submodule.
-rw-r--r-- | compiler/GHC/Data/Strict.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/Hs/Decls.hs | 3 | ||||
-rw-r--r-- | compiler/GHC/Parser.y | 14 | ||||
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 24 | ||||
-rw-r--r-- | compiler/GHC/Parser/PostProcess/Haddock.hs | 8 | ||||
-rw-r--r-- | compiler/GHC/Rename/Module.hs | 10 | ||||
-rw-r--r-- | compiler/GHC/ThToHs.hs | 6 | ||||
-rw-r--r-- | compiler/Language/Haskell/Syntax/Decls.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr | 90 | ||||
-rw-r--r-- | testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr | 9 | ||||
-rw-r--r-- | testsuite/tests/parser/should_compile/DumpRenamedAst.stderr | 9 | ||||
-rw-r--r-- | testsuite/tests/parser/should_compile/DumpSemis.stderr | 9 | ||||
-rw-r--r-- | testsuite/tests/parser/should_compile/T20452.stderr | 18 | ||||
-rw-r--r-- | utils/check-exact/ExactPrint.hs | 6 | ||||
m--------- | utils/haddock | 0 |
15 files changed, 195 insertions, 19 deletions
diff --git a/compiler/GHC/Data/Strict.hs b/compiler/GHC/Data/Strict.hs index d028d51c64..1166c56454 100644 --- a/compiler/GHC/Data/Strict.hs +++ b/compiler/GHC/Data/Strict.hs @@ -9,6 +9,7 @@ module GHC.Data.Strict ( Maybe(Nothing, Just), fromMaybe, + isNothing, Pair(And), -- Not used at the moment: @@ -29,6 +30,10 @@ fromMaybe :: a -> Maybe a -> a fromMaybe d Nothing = d fromMaybe _ (Just x) = x +isNothing :: Maybe a -> Bool +isNothing Nothing = True +isNothing (Just _) = False + apMaybe :: Maybe (a -> b) -> Maybe a -> Maybe b apMaybe (Just f) (Just x) = Just (f x) apMaybe _ _ = Nothing diff --git a/compiler/GHC/Hs/Decls.hs b/compiler/GHC/Hs/Decls.hs index 8e48036673..c920f9a13f 100644 --- a/compiler/GHC/Hs/Decls.hs +++ b/compiler/GHC/Hs/Decls.hs @@ -131,6 +131,7 @@ import GHC.Data.Bag import GHC.Data.Maybe import Data.Data (Data) import Data.Foldable (toList) +import qualified GHC.Data.Strict as Strict {- ************************************************************************ @@ -446,9 +447,11 @@ instance (OutputableBndrId p) => Outputable (TyClDecl (GhcPass p)) where ppr (ClassDecl {tcdCtxt = context, tcdLName = lclas, tcdTyVars = tyvars, tcdFixity = fixity, tcdFDs = fds, + tcdTkWhere = tkWhere, tcdSigs = sigs, tcdMeths = methods, tcdATs = ats, tcdATDefs = at_defs}) | null sigs && isEmptyBag methods && null ats && null at_defs -- No "where" part + && Strict.isNothing tkWhere = top_matter | otherwise -- Laid out diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y index cebeba3809..c24eb3cd27 100644 --- a/compiler/GHC/Parser.y +++ b/compiler/GHC/Parser.y @@ -1244,8 +1244,8 @@ topdecl :: { LHsDecl GhcPs } -- cl_decl :: { LTyClDecl GhcPs } : 'class' tycl_hdr fds where_cls - {% (mkClassDecl (comb4 $1 $2 $3 $4) $2 $3 (sndOf3 $ unLoc $4) (thdOf3 $ unLoc $4)) - (mj AnnClass $1:(fst $ unLoc $3)++(fstOf3 $ unLoc $4)) } + {% (mkClassDecl (comb4 $1 $2 $3 $4) (hsTok $1) $2 $3 (snd $ unLoc $4)) + (mj AnnClass $1:(fst $ unLoc $3)++(fst $ unLoc $4)) } -- Type declarations (toplevel) -- @@ -1721,14 +1721,14 @@ decllist_cls -- Class body -- -where_cls :: { Located ([AddEpAnn] - ,(OrdList (LHsDecl GhcPs)) -- Reversed - ,LayoutInfo GhcPs) } +where_cls :: { Located ([AddEpAnn], PsClassWhereClause) } -- No implicit parameters -- May have type declarations : 'where' decllist_cls { sLL $1 $> (mj AnnWhere $1:(fstOf3 $ unLoc $2) - ,sndOf3 $ unLoc $2,thdOf3 $ unLoc $2) } - | {- empty -} { noLoc ([],nilOL,NoLayoutInfo) } + ,PsClassWhereClause (thdOf3 $ unLoc $2) + (Strict.Just (hsTok $1)) + (sndOf3 $ unLoc $2)) } + | {- empty -} { noLoc ([],PsClassWhereClause NoLayoutInfo Strict.Nothing nilOL) } -- Declarations in instance bodies -- diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index c42501278f..0853ac78a6 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -22,7 +22,7 @@ module GHC.Parser.PostProcess ( mkHsIntegral, mkHsFractional, mkHsIsString, mkHsDo, mkSpliceDecl, mkRoleAnnotDecl, - mkClassDecl, + PsClassWhereClause(..), mkClassDecl, mkTyData, mkDataFamInst, mkTySynonym, mkTyFamInstEqn, mkStandaloneKindSig, @@ -188,27 +188,41 @@ mkTyClD (L loc d) = L loc (TyClD noExtField d) mkInstD :: LInstDecl (GhcPass p) -> LHsDecl (GhcPass p) mkInstD (L loc d) = L loc (InstD noExtField d) +data PsClassWhereClause = + PsClassWhereClause { + pcwcLayoutInfo :: !(LayoutInfo GhcPs), + pcwcTkWhere :: !(Strict.Maybe (LHsToken "where" GhcPs)), + pcwcDecls :: !(OrdList (LHsDecl GhcPs)) -- Reversed + } + mkClassDecl :: SrcSpan + -> LHsToken "class" GhcPs -> Located (Maybe (LHsContext GhcPs), LHsType GhcPs) -> Located (a,[LHsFunDep GhcPs]) - -> OrdList (LHsDecl GhcPs) - -> LayoutInfo GhcPs + -> PsClassWhereClause -> [AddEpAnn] -> P (LTyClDecl GhcPs) -mkClassDecl loc' (L _ (mcxt, tycl_hdr)) fds where_cls layoutInfo annsIn +mkClassDecl loc' tkClass (L _ (mcxt, tycl_hdr)) fds pcwc annsIn = do { let loc = noAnnSrcSpan loc' - ; (binds, sigs, ats, at_defs, _, docs) <- cvBindsAndSigs where_cls + ; let PsClassWhereClause + { pcwcLayoutInfo = layoutInfo + , pcwcTkWhere = tkWhere + , pcwcDecls = decls + } = pcwc + ; (binds, sigs, ats, at_defs, _, docs) <- cvBindsAndSigs decls ; (cls, tparams, fixity, ann) <- checkTyClHdr True tycl_hdr ; tyvars <- checkTyVars (text "class") whereDots cls tparams ; cs <- getCommentsFor (locA loc) -- Get any remaining comments ; let anns' = addAnns (EpAnn (spanAsAnchor $ locA loc) annsIn emptyComments) ann cs ; return (L loc (ClassDecl { tcdCExt = (anns', NoAnnSortKey) , tcdLayout = layoutInfo + , tcdTkClass = tkClass , tcdCtxt = mcxt , tcdLName = cls, tcdTyVars = tyvars , tcdFixity = fixity , tcdFDs = snd (unLoc fds) + , tcdTkWhere = tkWhere , tcdSigs = mkClassOpSigs sigs , tcdMeths = binds , tcdATs = ats, tcdATDefs = at_defs diff --git a/compiler/GHC/Parser/PostProcess/Haddock.hs b/compiler/GHC/Parser/PostProcess/Haddock.hs index 706423c099..cf1f233140 100644 --- a/compiler/GHC/Parser/PostProcess/Haddock.hs +++ b/compiler/GHC/Parser/PostProcess/Haddock.hs @@ -498,8 +498,8 @@ instance HasHaddock (HsDecl GhcPs) where -- -- ^ Comment on the second method -- addHaddock (TyClD _ decl) - | ClassDecl { tcdCExt = (x, NoAnnSortKey), tcdLayout, - tcdCtxt, tcdLName, tcdTyVars, tcdFixity, tcdFDs, + | ClassDecl { tcdCExt = (x, NoAnnSortKey), tcdLayout, tcdTkClass, + tcdCtxt, tcdLName, tcdTyVars, tcdFixity, tcdFDs, tcdTkWhere, tcdSigs, tcdMeths, tcdATs, tcdATDefs } <- decl = do registerHdkA tcdLName @@ -509,8 +509,8 @@ instance HasHaddock (HsDecl GhcPs) where flattenBindsAndSigs (tcdMeths, tcdSigs, tcdATs, tcdATDefs, [], []) pure $ let (tcdMeths', tcdSigs', tcdATs', tcdATDefs', _, tcdDocs) = partitionBindsAndSigs where_cls' - decl' = ClassDecl { tcdCExt = (x, NoAnnSortKey), tcdLayout - , tcdCtxt, tcdLName, tcdTyVars, tcdFixity, tcdFDs + decl' = ClassDecl { tcdCExt = (x, NoAnnSortKey), tcdLayout, tcdTkClass + , tcdCtxt, tcdLName, tcdTyVars, tcdFixity, tcdFDs, tcdTkWhere , tcdSigs = tcdSigs' , tcdMeths = tcdMeths' , tcdATs = tcdATs' diff --git a/compiler/GHC/Rename/Module.hs b/compiler/GHC/Rename/Module.hs index b0bb1cbd68..4fa4844ddc 100644 --- a/compiler/GHC/Rename/Module.hs +++ b/compiler/GHC/Rename/Module.hs @@ -1840,9 +1840,12 @@ rnTyClDecl (DataDecl , tcdDExt = rn_info }, fvs) } } rnTyClDecl (ClassDecl { tcdLayout = layout, + tcdTkClass = tkClass, tcdCtxt = context, tcdLName = lcls, tcdTyVars = tyvars, tcdFixity = fixity, - tcdFDs = fds, tcdSigs = sigs, + tcdFDs = fds, + tcdTkWhere = tkWhere, + tcdSigs = sigs, tcdMeths = mbinds, tcdATs = ats, tcdATDefs = at_defs, tcdDocs = docs}) = do { lcls' <- lookupLocatedTopConstructorRnN lcls @@ -1895,9 +1898,12 @@ rnTyClDecl (ClassDecl { tcdLayout = layout, ; let all_fvs = meth_fvs `plusFV` stuff_fvs `plusFV` fv_at_defs ; docs' <- traverse rnLDocDecl docs ; return (ClassDecl { tcdLayout = rnLayoutInfo layout, + tcdTkClass = tkClass, tcdCtxt = context', tcdLName = lcls', tcdTyVars = tyvars', tcdFixity = fixity, - tcdFDs = fds', tcdSigs = sigs', + tcdFDs = fds', + tcdTkWhere = tkWhere, + tcdSigs = sigs', tcdMeths = mbinds', tcdATs = ats', tcdATDefs = at_defs', tcdDocs = docs', tcdCExt = all_fvs }, all_fvs ) } diff --git a/compiler/GHC/ThToHs.hs b/compiler/GHC/ThToHs.hs index 0a1fb615ec..1dc0ba0a0a 100644 --- a/compiler/GHC/ThToHs.hs +++ b/compiler/GHC/ThToHs.hs @@ -52,6 +52,7 @@ import GHC.Utils.Lexeme import GHC.Utils.Misc import GHC.Data.FastString import GHC.Utils.Panic +import qualified GHC.Data.Strict as Strict import Language.Haskell.Syntax.Basic (FieldLabelString(..)) @@ -321,9 +322,12 @@ cvtDec (ClassD ctxt cl tvs fds decs) (failWith $ DefaultDataInstDecl adts') ; returnJustLA $ TyClD noExtField $ ClassDecl { tcdCExt = (noAnn, NoAnnSortKey), tcdLayout = NoLayoutInfo + , tcdTkClass = noHsTok , tcdCtxt = mkHsContextMaybe cxt', tcdLName = tc', tcdTyVars = tvs' , tcdFixity = Prefix - , tcdFDs = fds', tcdSigs = Hs.mkClassOpSigs sigs' + , tcdFDs = fds' + , tcdTkWhere = Strict.Nothing + , tcdSigs = Hs.mkClassOpSigs sigs' , tcdMeths = binds' , tcdATs = fams', tcdATDefs = at_defs', tcdDocs = [] } -- no docs in TH ^^ diff --git a/compiler/Language/Haskell/Syntax/Decls.hs b/compiler/Language/Haskell/Syntax/Decls.hs index 21a03c9c22..709f36e941 100644 --- a/compiler/Language/Haskell/Syntax/Decls.hs +++ b/compiler/Language/Haskell/Syntax/Decls.hs @@ -99,6 +99,7 @@ import Language.Haskell.Syntax.Extension import Language.Haskell.Syntax.Type import Language.Haskell.Syntax.Basic (Role) +import qualified GHC.Data.Strict as Strict import GHC.Types.Basic (TopLevelFlag, OverlapMode, RuleName, Activation) import GHC.Types.ForeignCall (CType, CCallConv, Safety, Header, CLabelString, CCallTarget, CExportSpec) import GHC.Types.Fixity (LexicalFixity) @@ -457,11 +458,13 @@ data TyClDecl pass | ClassDecl { tcdCExt :: XClassDecl pass, -- ^ Post renamer, FVs tcdLayout :: !(LayoutInfo pass), -- ^ Explicit or virtual braces -- See Note [Class LayoutInfo] + tcdTkClass :: !(LHsToken "class" pass), -- ^ The "class" token tcdCtxt :: Maybe (LHsContext pass), -- ^ Context... tcdLName :: LIdP pass, -- ^ Name of the class tcdTyVars :: LHsQTyVars pass, -- ^ Class type variables tcdFixity :: LexicalFixity, -- ^ Fixity used in the declaration tcdFDs :: [LHsFunDep pass], -- ^ Functional deps + tcdTkWhere :: !(Strict.Maybe (LHsToken "where" pass)), -- ^ The "where" token tcdSigs :: [LSig pass], -- ^ Methods' signatures tcdMeths :: LHsBinds pass, -- ^ Default methods tcdATs :: [LFamilyDecl pass], -- ^ Associated types; diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr index 212f3f9bec..335d76247a 100644 --- a/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr @@ -61,6 +61,10 @@ (NoAnnSortKey)) (VirtualBraces (3)) + (L + (TokenLoc + (EpaSpan { T17544.hs:5:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:5:7-8 }) @@ -85,6 +89,11 @@ {OccName: a}))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T17544.hs:5:12-16 })) + (HsTok))) [(L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:6:3-16 }) (ClassOpSig @@ -198,6 +207,10 @@ (NoAnnSortKey)) (VirtualBraces (3)) + (L + (TokenLoc + (EpaSpan { T17544.hs:9:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:9:7-8 }) @@ -222,6 +235,11 @@ {OccName: a}))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T17544.hs:9:12-16 })) + (HsTok))) [(L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:10:3-16 }) (ClassOpSig @@ -333,6 +351,10 @@ (NoAnnSortKey)) (VirtualBraces (3)) + (L + (TokenLoc + (EpaSpan { T17544.hs:13:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:13:7-8 }) @@ -357,6 +379,11 @@ {OccName: a}))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T17544.hs:13:12-16 })) + (HsTok))) [(L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:14:3-16 }) (ClassOpSig @@ -471,6 +498,10 @@ (NoAnnSortKey)) (VirtualBraces (3)) + (L + (TokenLoc + (EpaSpan { T17544.hs:17:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:17:7-8 }) @@ -495,6 +526,11 @@ {OccName: a}))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T17544.hs:17:12-16 })) + (HsTok))) [(L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:18:3-16 }) (ClassOpSig @@ -669,6 +705,10 @@ (TokenLoc (EpaSpan { T17544.hs:22:30 })) (HsTok))) + (L + (TokenLoc + (EpaSpan { T17544.hs:22:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:22:7-8 }) @@ -693,6 +733,11 @@ {OccName: a}))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T17544.hs:22:12-16 })) + (HsTok))) [] {Bag(LocatedA (HsBind GhcPs)): []} @@ -946,6 +991,10 @@ (TokenLoc (EpaSpan { T17544.hs:28:30 })) (HsTok))) + (L + (TokenLoc + (EpaSpan { T17544.hs:28:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:28:7-8 }) @@ -970,6 +1019,11 @@ {OccName: a}))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T17544.hs:28:12-16 })) + (HsTok))) [] {Bag(LocatedA (HsBind GhcPs)): []} @@ -1223,6 +1277,10 @@ (TokenLoc (EpaSpan { T17544.hs:34:30 })) (HsTok))) + (L + (TokenLoc + (EpaSpan { T17544.hs:34:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:34:7-8 }) @@ -1247,6 +1305,11 @@ {OccName: a}))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T17544.hs:34:12-16 })) + (HsTok))) [] {Bag(LocatedA (HsBind GhcPs)): []} @@ -1500,6 +1563,10 @@ (TokenLoc (EpaSpan { T17544.hs:40:30 })) (HsTok))) + (L + (TokenLoc + (EpaSpan { T17544.hs:40:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:40:7-8 }) @@ -1524,6 +1591,11 @@ {OccName: a}))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T17544.hs:40:12-16 })) + (HsTok))) [] {Bag(LocatedA (HsBind GhcPs)): []} @@ -1777,6 +1849,10 @@ (TokenLoc (EpaSpan { T17544.hs:46:30 })) (HsTok))) + (L + (TokenLoc + (EpaSpan { T17544.hs:46:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:46:7-8 }) @@ -1801,6 +1877,11 @@ {OccName: a}))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T17544.hs:46:12-16 })) + (HsTok))) [] {Bag(LocatedA (HsBind GhcPs)): []} @@ -2054,6 +2135,10 @@ (TokenLoc (EpaSpan { T17544.hs:52:32 })) (HsTok))) + (L + (TokenLoc + (EpaSpan { T17544.hs:52:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:52:7-9 }) @@ -2078,6 +2163,11 @@ {OccName: a}))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T17544.hs:52:13-17 })) + (HsTok))) [] {Bag(LocatedA (HsBind GhcPs)): []} diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr index 28f3f4ef63..c4eee108ce 100644 --- a/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr @@ -281,6 +281,10 @@ (NoAnnSortKey)) (VirtualBraces (5)) + (L + (TokenLoc + (EpaSpan { T17544_kw.hs:21:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T17544_kw.hs:21:7-9 }) @@ -305,6 +309,11 @@ {OccName: a}))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T17544_kw.hs:23:3-7 })) + (HsTok))) [(L (SrcSpanAnn (EpAnnNotUsed) { T17544_kw.hs:24:5-18 }) (ClassOpSig diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr index cd5c002a6a..3b1bc6658a 100644 --- a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr @@ -1052,6 +1052,10 @@ []} (VirtualBraces (3)) + (L + (TokenLoc + (EpaSpan { DumpRenamedAst.hs:27:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:27:7 }) @@ -1074,6 +1078,11 @@ {Name: a})))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { DumpRenamedAst.hs:27:11-15 })) + (HsTok))) [] {Bag(LocatedA (HsBind Name)): []} diff --git a/testsuite/tests/parser/should_compile/DumpSemis.stderr b/testsuite/tests/parser/should_compile/DumpSemis.stderr index faa926b6c4..2427224e47 100644 --- a/testsuite/tests/parser/should_compile/DumpSemis.stderr +++ b/testsuite/tests/parser/should_compile/DumpSemis.stderr @@ -1060,6 +1060,10 @@ (NoAnnSortKey)) (VirtualBraces (3)) + (L + (TokenLoc + (EpaSpan { DumpSemis.hs:28:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:28:7-19 }) @@ -1103,6 +1107,11 @@ {OccName: Type}))))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { DumpSemis.hs:28:40-44 })) + (HsTok))) [(L (SrcSpanAnn (EpAnnNotUsed) { DumpSemis.hs:29:3-23 }) (ClassOpSig diff --git a/testsuite/tests/parser/should_compile/T20452.stderr b/testsuite/tests/parser/should_compile/T20452.stderr index 0c2982dd9c..75368953b0 100644 --- a/testsuite/tests/parser/should_compile/T20452.stderr +++ b/testsuite/tests/parser/should_compile/T20452.stderr @@ -248,6 +248,10 @@ (TokenLoc (EpaSpan { T20452.hs:8:85 })) (HsTok))) + (L + (TokenLoc + (EpaSpan { T20452.hs:8:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T20452.hs:8:7-12 }) @@ -403,6 +407,11 @@ {OccName: String}))))]))))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T20452.hs:8:78-82 })) + (HsTok))) [] {Bag(LocatedA (HsBind GhcPs)): []} @@ -442,6 +451,10 @@ (TokenLoc (EpaSpan { T20452.hs:9:85 })) (HsTok))) + (L + (TokenLoc + (EpaSpan { T20452.hs:9:1-5 })) + (HsTok)) (Nothing) (L (SrcSpanAnn (EpAnnNotUsed) { T20452.hs:9:7-12 }) @@ -603,6 +616,11 @@ {OccName: String}))))]))))))]) (Prefix) [] + (Just + (L + (TokenLoc + (EpaSpan { T20452.hs:9:78-82 })) + (HsTok))) [] {Bag(LocatedA (HsBind GhcPs)): []} diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs index 19548f58ab..85b70076ff 100644 --- a/utils/check-exact/ExactPrint.hs +++ b/utils/check-exact/ExactPrint.hs @@ -3461,9 +3461,11 @@ instance ExactPrint (TyClDecl GhcPs) where exact (ClassDecl {tcdCExt = (an, sortKey), tcdLayout = lo, + tcdTkClass = tkClass, tcdCtxt = context, tcdLName = lclas, tcdTyVars = tyvars, tcdFixity = fixity, tcdFDs = fds, + tcdTkWhere = tkWhere, tcdSigs = sigs, tcdMeths = methods, tcdATs = ats, tcdATDefs = at_defs, tcdDocs = _docs}) @@ -3475,9 +3477,11 @@ instance ExactPrint (TyClDecl GhcPs) where an2 <- markEpAnnL an1 lidl AnnCloseC return (ClassDecl {tcdCExt = (an2, sortKey), tcdLayout = lo, + tcdTkClass = tkClass, tcdCtxt = context', tcdLName = lclas', tcdTyVars = tyvars', tcdFixity = fixity, tcdFDs = fds', + tcdTkWhere = tkWhere, tcdSigs = sigs, tcdMeths = methods, tcdATs = ats, tcdATDefs = at_defs, tcdDocs = _docs}) @@ -3502,9 +3506,11 @@ instance ExactPrint (TyClDecl GhcPs) where at_defs' = undynamic ds return (ClassDecl {tcdCExt = (an3, sortKey), tcdLayout = lo, + tcdTkClass = tkClass, tcdCtxt = context', tcdLName = lclas', tcdTyVars = tyvars', tcdFixity = fixity, tcdFDs = fds', + tcdTkWhere = tkWhere, tcdSigs = sigs', tcdMeths = methods', tcdATs = ats', tcdATDefs = at_defs', tcdDocs = _docs}) diff --git a/utils/haddock b/utils/haddock -Subproject edc72530978d8a9ec92f51d288484986ec0051e +Subproject 0fa7dc86dccd751e06845c7ac3908230df2add7 |