[Git][ghc/ghc][master] EPA: Add TTG fields to FamilyInfo
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 7dedcf13 by Alan Zimmerman at 2026-10-16T19:03:17-04:00 EPA: Add TTG fields to FamilyInfo This commit is a simple add, with unused extension fields. It lays the groundwork for using them for exact print annotations - - - - - 22 changed files: - compiler/GHC/Hs/Decls.hs - compiler/GHC/Hs/Utils.hs - compiler/GHC/HsToCore/Quote.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Rename/Module.hs - compiler/GHC/Tc/TyCl.hs - compiler/GHC/ThToHs.hs - compiler/Language/Haskell/Syntax/Decls.hs - compiler/Language/Haskell/Syntax/Extension.hs - testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr - testsuite/tests/parser/should_compile/DumpParsedAst.stderr - testsuite/tests/parser/should_compile/DumpRenamedAst.stderr - testsuite/tests/parser/should_compile/KindSigs.stderr - utils/check-exact/ExactPrint.hs - utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs - utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs - utils/haddock/haddock-api/src/Haddock/Convert.hs - utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs - utils/haddock/haddock-api/src/Haddock/Types.hs Changes: ===================================== compiler/GHC/Hs/Decls.hs ===================================== @@ -482,12 +482,12 @@ instance NoAnn AnnSynDecl where ------------- Pretty printing FamilyDecls ----------- -pprFlavour :: FamilyInfo pass -> SDoc -pprFlavour DataFamily = text "data" -pprFlavour OpenTypeFamily = text "type" +pprFlavour :: FamilyInfo (GhcPass pass) -> SDoc +pprFlavour DataFamily {} = text "data" +pprFlavour OpenTypeFamily {} = text "type" pprFlavour (ClosedTypeFamily {}) = text "type" -instance Outputable (FamilyInfo pass) where +instance Outputable (FamilyInfo (GhcPass pass)) where ppr info = pprFlavour info <+> text "family" @@ -642,8 +642,8 @@ tyClDeclFlavour (ClassDecl {}) = ClassFlavour tyClDeclFlavour (SynDecl {}) = TypeSynonymFlavour tyClDeclFlavour (FamDecl { tcdFam = FamilyDecl { fdInfo = info }}) = case info of - DataFamily -> OpenFamilyFlavour (IAmData DataType) Nothing - OpenTypeFamily -> OpenFamilyFlavour IAmType Nothing + DataFamily {} -> OpenFamilyFlavour (IAmData DataType) Nothing + OpenTypeFamily {} -> OpenFamilyFlavour IAmType Nothing ClosedTypeFamily {} -> ClosedTypeFamilyFlavour tyClDeclFlavour (DataDecl { tcdDataDefn = HsDataDefn { dd_cons = nd } }) = case dataDefnConsNewOrData nd of @@ -742,6 +742,11 @@ resultVariableName _ = Nothing type instance XCInjectivityAnn (GhcPass _) = TokRarrow type instance XXInjectivityAnn (GhcPass _) = DataConCantHappen +type instance XDataFamily (GhcPass _) = NoExtField +type instance XOpenTypeFamily (GhcPass _) = NoExtField +type instance XClosedTypeFamily (GhcPass _) = NoExtField +type instance XXFamilyInfo (GhcPass _) = DataConCantHappen + instance OutputableBndrId p => Outputable (FamilyDecl (GhcPass p)) where ppr (FamilyDecl { fdInfo = info, fdLName = ltycon @@ -768,7 +773,7 @@ instance OutputableBndrId p hsep [ vbar, ppr lhs, arrow, hsep (map ppr rhs) ] Nothing -> empty (pp_where, pp_eqns) = case info of - ClosedTypeFamily mb_eqns -> + ClosedTypeFamily _ mb_eqns -> ( text "where" , case mb_eqns of Nothing -> text ".." ===================================== compiler/GHC/Hs/Utils.hs ===================================== @@ -1543,15 +1543,15 @@ hsLTyClDeclBinders (L loc (DataDecl { tcdLName = (L _ name) familyInfoTyConFlavour :: Maybe tc -- ^ Just cls <=> this is an associated family of class cls - -> FamilyInfo pass + -> FamilyInfo (GhcPass pass) -> TyConFlavour tc familyInfoTyConFlavour mb_parent_tycon info = case info of - DataFamily -> OpenFamilyFlavour (IAmData DataType) mb_parent_tycon - OpenTypeFamily -> OpenFamilyFlavour IAmType mb_parent_tycon - ClosedTypeFamily _ -> assert (isNothing mb_parent_tycon) - -- See Note [Closed type family mb_parent_tycon] - ClosedTypeFamilyFlavour + DataFamily _ -> OpenFamilyFlavour (IAmData DataType) mb_parent_tycon + OpenTypeFamily _ -> OpenFamilyFlavour IAmType mb_parent_tycon + ClosedTypeFamily _ _ -> assert (isNothing mb_parent_tycon) + -- See Note [Closed type family mb_parent_tycon] + ClosedTypeFamilyFlavour ------------------- hsForeignDeclsBinders :: forall p a. (UnXRec (GhcPass p), IsSrcSpanAnn p a) ===================================== compiler/GHC/HsToCore/Quote.hs ===================================== @@ -554,19 +554,19 @@ repFamilyDecl decl@(L loc (FamilyDecl { fdInfo = info ; dec <- addQTyVarBinds ReuseBoundNames tvs $ \bndrs -> addSimpleTyVarBinds ReuseBoundNames (maybeToList res_tv) $ case info of - ClosedTypeFamily Nothing -> + ClosedTypeFamily _ Nothing -> notHandled (ThAbstractClosedTypeFamily decl) - ClosedTypeFamily (Just eqns) -> + ClosedTypeFamily _ (Just eqns) -> do { eqns1 <- mapM (repTyFamEqn . unLoc) eqns ; eqns2 <- coreListM tySynEqnTyConOcc eqns1 ; result <- repFamilyResultSig resultSig ; inj <- repInjectivityAnn injectivity ; repClosedFamilyD tc1 bndrs result inj eqns2 } - OpenTypeFamily -> + OpenTypeFamily _ -> do { result <- repFamilyResultSig resultSig ; inj <- repInjectivityAnn injectivity ; repOpenFamilyD tc1 bndrs result inj } - DataFamily -> + DataFamily _ -> do { kind <- repFamilyResultSigToMaybeKind resultSig ; repDataFamilyD tc1 bndrs kind } ; return (locA loc, dec) ===================================== compiler/GHC/Iface/Ext/Ast.hs ===================================== @@ -1669,7 +1669,7 @@ instance ToHie (LocatedA (FamilyDecl GhcRn)) where injSpan = maybe NoScope (mkScope . getLocA) inj instance ToHie (FamilyInfo GhcRn) where - toHie (ClosedTypeFamily (Just eqns)) = concatM $ + toHie (ClosedTypeFamily _ (Just eqns)) = concatM $ [ concatMapM (locOnly . getLocA) eqns , toHie $ map go eqns ] ===================================== compiler/GHC/Parser.y ===================================== @@ -1389,7 +1389,7 @@ ty_decl :: { LTyClDecl GhcPs } -- data/newtype family | 'data' 'family' type opt_datafam_kind_sig {% do { let { tdcolon = fst $ unLoc $4 } - ; mkFamDecl (comb4 $1 $2 $3 $4) DataFamily TopLevel $3 + ; mkFamDecl (comb4 $1 $2 $3 $4) (DataFamily noExtField) TopLevel $3 (snd $ unLoc $4) Nothing (AnnFamilyDecl [] [] noAnn (epTok $1) (epTok $2) tdcolon noAnn noAnn noAnn noAnn noAnn noAnn) }} @@ -1523,10 +1523,10 @@ inj_varids :: { Located [LocatedN RdrName] } -- Closed type families where_type_family :: { Located ((EpToken "where", (EpToken "{", EpToken "..", EpToken "}")),FamilyInfo GhcPs) } - : {- empty -} { noLoc (noAnn,OpenTypeFamily) } + : {- empty -} { noLoc (noAnn,OpenTypeFamily noExtField) } | 'where' ty_fam_inst_eqn_list { sLL $1 $> ((epTok $1,(fst $ unLoc $2)) - ,ClosedTypeFamily (fmap reverse $ snd $ unLoc $2)) } + , ClosedTypeFamily noExtField (fmap reverse $ snd $ unLoc $2)) } ty_fam_inst_eqn_list :: { Located ((EpToken "{", EpToken "..", EpToken "}"),Maybe [LTyFamInstEqn GhcPs]) } : '{' ty_fam_inst_eqns '}' { sLL $1 $> ((epTok $1,noAnn, epTok $3) @@ -1578,7 +1578,7 @@ at_decl_cls :: { LHsDecl GhcPs } : -- data family declarations, with optional 'family' keyword 'data' opt_family type opt_datafam_kind_sig {% do { let { tdcolon = fst $ unLoc $4 } - ; liftM mkTyClD (mkFamDecl (comb3 $1 $3 $4) DataFamily NotTopLevel $3 + ; liftM mkTyClD (mkFamDecl (comb3 $1 $3 $4) (DataFamily noExtField) NotTopLevel $3 (snd $ unLoc $4) Nothing (AnnFamilyDecl [] [] noAnn (epTok $1) $2 tdcolon noAnn noAnn noAnn noAnn noAnn noAnn)) }} @@ -1587,14 +1587,14 @@ at_decl_cls :: { LHsDecl GhcPs } | 'type' type opt_at_kind_inj_sig {% do { let { (tdcolon, tequal, tvbar) = fst $ unLoc $3 } ; liftM mkTyClD - (mkFamDecl (comb3 $1 $2 $3) OpenTypeFamily NotTopLevel $2 + (mkFamDecl (comb3 $1 $2 $3) (OpenTypeFamily noExtField) NotTopLevel $2 (fst . snd $ unLoc $3) (snd . snd $ unLoc $3) (AnnFamilyDecl [] [] (epTok $1) noAnn noAnn tdcolon tequal tvbar noAnn noAnn noAnn noAnn)) }} | 'type' 'family' type opt_at_kind_inj_sig {% do { let { (tdcolon, tequal, tvbar) = fst $ unLoc $4 } ; liftM mkTyClD - (mkFamDecl (comb3 $1 $3 $4) OpenTypeFamily NotTopLevel $3 + (mkFamDecl (comb3 $1 $3 $4) (OpenTypeFamily noExtField) NotTopLevel $3 (fst . snd $ unLoc $4) (snd . snd $ unLoc $4) (AnnFamilyDecl [] [] (epTok $1) noAnn (epTok $2) tdcolon tequal tvbar noAnn noAnn noAnn noAnn)) }} ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -384,8 +384,8 @@ mkFamDecl loc info topLevel lhs ksig injAnn annsIn , fdInjectivityAnn = injAnn }))) } where equals_or_where = case info of - DataFamily -> empty - OpenTypeFamily -> empty + DataFamily {} -> empty + OpenTypeFamily {} -> empty ClosedTypeFamily {} -> whereDots mkSpliceDecl :: LHsExpr GhcPs -> (LHsDecl GhcPs) ===================================== compiler/GHC/Rename/Module.hs ===================================== @@ -2437,15 +2437,15 @@ rnFamDecl mb_cls (FamilyDecl { fdLName = tycon, fdTyVars = tyvars ---------------------- rn_info :: FamilyInfo GhcPs -> RnM (FamilyInfo GhcRn, FreeNames) - rn_info (ClosedTypeFamily (Just eqns)) + rn_info (ClosedTypeFamily x (Just eqns)) = do { (eqns', fvs) <- rnList (rnTyFamInstEqn (NonAssocTyFamEqn ClosedTyFam)) eqns -- no class context - ; return (ClosedTypeFamily (Just eqns'), fvs) } - rn_info (ClosedTypeFamily Nothing) - = return (ClosedTypeFamily Nothing, emptyFNs) - rn_info OpenTypeFamily = return (OpenTypeFamily, emptyFNs) - rn_info DataFamily = return (DataFamily, emptyFNs) + ; return (ClosedTypeFamily x (Just eqns'), fvs) } + rn_info (ClosedTypeFamily x Nothing) + = return (ClosedTypeFamily x Nothing, emptyFNs) + rn_info (OpenTypeFamily x) = return (OpenTypeFamily x, emptyFNs) + rn_info (DataFamily x) = return (DataFamily x, emptyFNs) rnFamResultSig :: HsDocContext -> FamilyResultSig GhcPs ===================================== compiler/GHC/Tc/TyCl.hs ===================================== @@ -2196,7 +2196,7 @@ kcTyClDecl (FamDecl _ (FamilyDecl { fdInfo = fd_info })) fam_tc -- closed type families look at their equations, but other families don't -- do anything here = case fd_info of - ClosedTypeFamily (Just eqns) -> mapM_ (kcTyFamInstEqn fam_tc) eqns + ClosedTypeFamily _ (Just eqns) -> mapM_ (kcTyFamInstEqn fam_tc) eqns _ -> return () ------------------- @@ -3387,7 +3387,7 @@ tcFamDecl1 parent (FamilyDecl { fdInfo = fam_info , fdLName = tc_lname@(L _ tc_name) , fdResultSig = L _ sig , fdInjectivityAnn = inj }) - | DataFamily <- fam_info + | DataFamily _ <- fam_info = bindTyClTyVarsAndZonk tc_name $ \ kind tc_bndrs nb_eta res_kind -> do { traceTc "tcFamDecl1 data family:" (ppr tc_name) ; checkFamFlag tc_name @@ -3413,7 +3413,7 @@ tcFamDecl1 parent (FamilyDecl { fdInfo = fam_info parent inj ; return (tycon, []) } - | OpenTypeFamily <- fam_info + | OpenTypeFamily _ <- fam_info = bindTyClTyVarsAndZonk tc_name $ \ kind tc_bndrs _nb_eta res_kind -> do { traceTc "tcFamDecl1 open type family:" (ppr tc_name) ; checkFamFlag tc_name @@ -3424,7 +3424,7 @@ tcFamDecl1 parent (FamilyDecl { fdInfo = fam_info parent inj' ; return (tycon, []) } - | ClosedTypeFamily mb_eqns <- fam_info + | ClosedTypeFamily _ mb_eqns <- fam_info = -- Closed type families are a little tricky, because they contain the definition -- of both the type family and the equations for a CoAxiom. do { traceTc "tcFamDecl1 Closed type family:" (ppr tc_name) ===================================== compiler/GHC/ThToHs.hs ===================================== @@ -373,7 +373,7 @@ cvtDec (DataFamilyD tc tvs kind) = do { (_, tc', tvs') <- cvt_tycl_hdr [] tc tvs ; result <- cvtMaybeKindToFamilyResultSig kind ; returnJustLA $ TyClD noExtField $ FamDecl noExtField $ - FamilyDecl noAnn DataFamily TopLevel tc' tvs' Prefix result Nothing } + FamilyDecl noAnn (DataFamily noExtField) TopLevel tc' tvs' Prefix result Nothing } cvtDec (DataInstD ctxt bndrs tys ksig constrs derivs) = do { (ctxt', tc', bndrs', typats') <- cvt_datainst_hdr ctxt bndrs tys @@ -427,14 +427,14 @@ cvtDec (TySynInstD eqn) cvtDec (OpenTypeFamilyD head) = do { (tc', tyvars', result', injectivity') <- cvt_tyfam_head head ; returnJustLA $ TyClD noExtField $ FamDecl noExtField $ - FamilyDecl noAnn OpenTypeFamily TopLevel tc' tyvars' Prefix result' injectivity' + FamilyDecl noAnn (OpenTypeFamily noExtField) TopLevel tc' tyvars' Prefix result' injectivity' } cvtDec (ClosedTypeFamilyD head eqns) = do { (tc', tyvars', result', injectivity') <- cvt_tyfam_head head ; eqns' <- mapM cvtTySynEqn eqns ; returnJustLA $ TyClD noExtField $ FamDecl noExtField $ - FamilyDecl noAnn (ClosedTypeFamily (Just eqns')) TopLevel tc' tyvars' Prefix + FamilyDecl noAnn (ClosedTypeFamily noExtField (Just eqns')) TopLevel tc' tyvars' Prefix result' injectivity' } cvtDec (TH.RoleAnnotD tc roles) ===================================== compiler/Language/Haskell/Syntax/Decls.hs ===================================== @@ -503,15 +503,15 @@ isFamilyDecl _other = False -- | type family declaration isTypeFamilyDecl :: TyClDecl pass -> Bool isTypeFamilyDecl (FamDecl _ (FamilyDecl { fdInfo = info })) = case info of - OpenTypeFamily -> True + OpenTypeFamily {} -> True ClosedTypeFamily {} -> True _ -> False isTypeFamilyDecl _ = False -- | open type family info isOpenTypeFamilyInfo :: FamilyInfo pass -> Bool -isOpenTypeFamilyInfo OpenTypeFamily = True -isOpenTypeFamilyInfo _ = False +isOpenTypeFamilyInfo OpenTypeFamily {} = True +isOpenTypeFamilyInfo _ = False -- | closed type family info isClosedTypeFamilyInfo :: FamilyInfo pass -> Bool @@ -520,7 +520,7 @@ isClosedTypeFamilyInfo _ = False -- | data family declaration isDataFamilyDecl :: TyClDecl pass -> Bool -isDataFamilyDecl (FamDecl _ (FamilyDecl { fdInfo = DataFamily })) = True +isDataFamilyDecl (FamDecl _ (FamilyDecl { fdInfo = DataFamily _ })) = True isDataFamilyDecl _other = False -- Dealing with names @@ -771,11 +771,12 @@ data InjectivityAnn pass | XInjectivityAnn !(XXInjectivityAnn pass) data FamilyInfo pass - = DataFamily - | OpenTypeFamily + = DataFamily (XDataFamily pass) + | OpenTypeFamily (XOpenTypeFamily pass) -- | 'Nothing' if we're in an hs-boot file and the user -- said "type family Foo x where .." - | ClosedTypeFamily (Maybe [LTyFamInstEqn pass]) + | ClosedTypeFamily (XClosedTypeFamily pass) (Maybe [LTyFamInstEqn pass]) + | XFamilyInfo !(XXFamilyInfo pass) {- Note [Closed type family mb_parent_tycon] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ===================================== compiler/Language/Haskell/Syntax/Extension.hs ===================================== @@ -473,6 +473,13 @@ type family XXRoleAnnotDecl x type family XCInjectivityAnn x type family XXInjectivityAnn x +-- ------------------------------------- +-- FamilyInfo type families +type family XDataFamily x +type family XOpenTypeFamily x +type family XClosedTypeFamily x +type family XXFamilyInfo x + -- ===================================================================== -- Type families for the HsModule extension points ===================================== testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr ===================================== @@ -930,7 +930,8 @@ (EpTok (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) - (DataFamily) + (DataFamily + (NoExtField)) (NotTopLevel) (L (EpAnn @@ -1325,7 +1326,8 @@ (EpTok (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) - (DataFamily) + (DataFamily + (NoExtField)) (NotTopLevel) (L (EpAnn @@ -1720,7 +1722,8 @@ (EpTok (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) - (DataFamily) + (DataFamily + (NoExtField)) (NotTopLevel) (L (EpAnn @@ -2115,7 +2118,8 @@ (EpTok (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) - (DataFamily) + (DataFamily + (NoExtField)) (NotTopLevel) (L (EpAnn @@ -2510,7 +2514,8 @@ (EpTok (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) - (DataFamily) + (DataFamily + (NoExtField)) (NotTopLevel) (L (EpAnn @@ -2905,7 +2910,8 @@ (EpTok (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) - (DataFamily) + (DataFamily + (NoExtField)) (NotTopLevel) (L (EpAnn ===================================== testsuite/tests/parser/should_compile/DumpParsedAst.stderr ===================================== @@ -364,6 +364,7 @@ (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) (ClosedTypeFamily + (NoExtField) (Just [(L (EpAnn @@ -1148,6 +1149,7 @@ (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) (ClosedTypeFamily + (NoExtField) (Just [(L (EpAnn @@ -1545,7 +1547,8 @@ (EpTok (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) - (DataFamily) + (DataFamily + (NoExtField)) (TopLevel) (L (EpAnn ===================================== testsuite/tests/parser/should_compile/DumpRenamedAst.stderr ===================================== @@ -311,6 +311,7 @@ (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) (ClosedTypeFamily + (NoExtField) (Just [(L (EpAnn @@ -798,7 +799,8 @@ (EpTok (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) - (DataFamily) + (DataFamily + (NoExtField)) (TopLevel) (L (EpAnn @@ -1183,6 +1185,7 @@ (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) (ClosedTypeFamily + (NoExtField) (Just [(L (EpAnn @@ -1766,7 +1769,8 @@ (EpTok (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) - (OpenTypeFamily) + (OpenTypeFamily + (NoExtField)) (NotTopLevel) (L (EpAnn ===================================== testsuite/tests/parser/should_compile/KindSigs.stderr ===================================== @@ -113,6 +113,7 @@ (EpaSpan { <no location info> })) (EpTok (EpaSpan { <no location info> }))) (ClosedTypeFamily + (NoExtField) (Just [(L (EpAnn ===================================== utils/check-exact/ExactPrint.hs ===================================== @@ -3844,7 +3844,7 @@ instance ExactPrint (FamilyDecl GhcPs) where return (vb', Just inj') (w', oc', dd', cc', info') <- case info of - ClosedTypeFamily mb_eqns -> do + ClosedTypeFamily x mb_eqns -> do w' <- markEpToken w oc' <- markEpToken oc (dd', mb_eqns') <- @@ -3856,7 +3856,7 @@ instance ExactPrint (FamilyDecl GhcPs) where eqns' <- mapM markAnnotated eqns return (dd, Just eqns') cc' <- markEpToken cc - return (w',oc',dd',cc', ClosedTypeFamily mb_eqns') + return (w',oc',dd',cc', ClosedTypeFamily x mb_eqns') _ -> return (w,oc,dd,cc, info) return (FamilyDecl { fdExt = AnnFamilyDecl [] [] t' d' f' dc' eq' vb' w' oc' dd' cc' , fdInfo = info' @@ -3890,8 +3890,8 @@ instance ExactPrint (FamilyDecl GhcPs) where exactFlavour :: (Monad m, Monoid w) => (EpToken "data", EpToken "type") -> FamilyInfo GhcPs -> EP w m (EpToken "data", EpToken "type") -exactFlavour (td,tt) DataFamily = (\td' -> (td',tt)) <$> markEpToken td -exactFlavour (td,tt) OpenTypeFamily = (td,) <$> markEpToken tt +exactFlavour (td,tt) DataFamily {} = (\td' -> (td',tt)) <$> markEpToken td +exactFlavour (td,tt) OpenTypeFamily {} = (td,) <$> markEpToken tt exactFlavour (td,tt) (ClosedTypeFamily {}) = (td,) <$> markEpToken tt -- --------------------------------------------------------------------- ===================================== utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs ===================================== @@ -254,7 +254,7 @@ ppFam sDocContext decl@(FamilyDecl{fdInfo = info}) = decl' = case info of -- We don't need to print out a closed type family's equations -- for Hoogle, so pretend it doesn't have any. - ClosedTypeFamily{} -> decl{fdInfo = OpenTypeFamily} + ClosedTypeFamily{} -> decl{fdInfo = OpenTypeFamily noExtField} _ -> decl ppInstance :: DynFlags -> UnitState -> ClsInst -> [String] ===================================== utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs ===================================== @@ -373,11 +373,11 @@ ppFamDecl associated doc instances decl@(FamDecl{}) unicode = body = Maybe.catMaybes [familyEqns, documentationToLaTeX doc] whereBit = case fdInfo (tcdFam decl) of - ClosedTypeFamily _ -> keyword "where" + ClosedTypeFamily _ _ -> keyword "where" _ -> empty familyEqns - | FamilyDecl{fdInfo = ClosedTypeFamily (Just eqns)} <- tcdFam decl + | FamilyDecl{fdInfo = ClosedTypeFamily _ (Just eqns)} <- tcdFam decl , not (null eqns) = Just ( text "\\haddockbeginargs" @@ -429,9 +429,9 @@ ppFamHeader famly leader <+> famName <+> famSig <+> injAnn where leader = case info of - OpenTypeFamily -> keyword "type" - ClosedTypeFamily _ -> keyword "type" - DataFamily -> keyword "data" + OpenTypeFamily _ -> keyword "type" + ClosedTypeFamily _ _ -> keyword "type" + DataFamily _ -> keyword "data" famly | associated = id ===================================== utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs ===================================== @@ -548,7 +548,7 @@ ppFamDecl summary associated links instances fixities loc doc decl splice unicod ppFamHeader summary associated decl unicode qual <+> ppFixities fixities qual instancesBit - | FamilyDecl{fdInfo = ClosedTypeFamily mb_eqns} <- decl + | FamilyDecl{fdInfo = ClosedTypeFamily _ mb_eqns} <- decl , not summary = subEquations pkg qual $ map (ppFamDeclEqn . unLoc) $ Maybe.fromMaybe [] mb_eqns | otherwise = @@ -603,7 +603,7 @@ ppFamHeader ] where whereBit = case info of - ClosedTypeFamily _ -> keyword "where ..." + ClosedTypeFamily _ _ -> keyword "where ..." _ -> noHtml injAnn = case injectivity of @@ -622,9 +622,9 @@ ppFamilyLeader :: Bool -> FamilyInfo DocNameI -> Html ppFamilyLeader assoc info = keyword (typ ++ if assoc then "" else " family") where typ = case info of - OpenTypeFamily -> "type" - ClosedTypeFamily _ -> "type" - DataFamily -> "data" + OpenTypeFamily _ -> "type" + ClosedTypeFamily _ _ -> "type" + DataFamily _ -> "data" -- | Print the signature attached to a family ppResultSig :: FamilyResultSig DocNameI -> Unicode -> Qualification -> Html ===================================== utils/haddock/haddock-api/src/Haddock/Convert.hs ===================================== @@ -306,20 +306,20 @@ synifyTyCon _prr _coax tc | Just flav <- famTyConFlav_maybe tc = case flav of DataFamilyTyCon{} -> - mkFamDecl DataFamily - OpenTypeFamilyTyCon -> mkFamDecl OpenTypeFamily + mkFamDecl (DataFamily noExtField) + OpenTypeFamilyTyCon -> mkFamDecl (OpenTypeFamily noExtField) ClosedTypeFamilyTyCon ctf -> case ctf of CTF mb | Just (CoAxiom{co_ax_branches = branches}) <- mb -> mkFamDecl $ - ClosedTypeFamily $ + ClosedTypeFamily noExtField $ Just $ map (noLocA . synifyAxBranch tc) (fromBranches branches) | otherwise - -> mkFamDecl $ ClosedTypeFamily $ Just [] - CTF_BuiltIn {} -> mkFamDecl $ ClosedTypeFamily $ Just [] - CTF_Abstract -> mkFamDecl $ ClosedTypeFamily Nothing + -> mkFamDecl $ ClosedTypeFamily noExtField $ Just [] + CTF_BuiltIn {} -> mkFamDecl $ ClosedTypeFamily noExtField $ Just [] + CTF_Abstract -> mkFamDecl $ ClosedTypeFamily noExtField Nothing where resultVar = tyConFamilyResVar_maybe tc mkFamDecl i = ===================================== utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs ===================================== @@ -686,12 +686,12 @@ renameFamilyDecl ) renameFamilyInfo :: FamilyInfo GhcRn -> RnM (FamilyInfo DocNameI) -renameFamilyInfo DataFamily = return DataFamily -renameFamilyInfo OpenTypeFamily = return OpenTypeFamily -renameFamilyInfo (ClosedTypeFamily eqns) = +renameFamilyInfo (DataFamily x) = return (DataFamily x) +renameFamilyInfo (OpenTypeFamily x) = return (OpenTypeFamily x) +renameFamilyInfo (ClosedTypeFamily x eqns) = do eqns' <- mapM (mapM (mapM renameTyFamInstEqn)) eqns - return $ ClosedTypeFamily eqns' + return $ ClosedTypeFamily x eqns' renameDataDefn :: HsDataDefn GhcRn -> RnM (HsDataDefn DocNameI) renameDataDefn ===================================== utils/haddock/haddock-api/src/Haddock/Types.hs ===================================== @@ -1036,6 +1036,11 @@ type instance XSplicePat DocNameI = DataConCantHappen type instance XCInjectivityAnn DocNameI = NoExtField +type instance XDataFamily DocNameI = NoExtField +type instance XOpenTypeFamily DocNameI = NoExtField +type instance XClosedTypeFamily DocNameI = NoExtField +type instance XXFamilyInfo DocNameI = DataConCantHappen + type instance XCFunDep DocNameI = NoExtField type instance XCTyFamInstDecl DocNameI = NoExtField View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7dedcf135eeab1598af85bf319a398b9... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7dedcf135eeab1598af85bf319a398b9... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Marge Bot (@marge-bot)