Skip to content
Snippets Groups Projects
Commit c2f924c4 authored by batterseapower's avatar batterseapower
Browse files

Ignore the new associated type defaults like we ignore default methods

parent d5495918
No related branches found
No related tags found
No related merge requests found
...@@ -473,7 +473,7 @@ ppClassDecl :: [DocInstance DocName] -> SrcSpan ...@@ -473,7 +473,7 @@ ppClassDecl :: [DocInstance DocName] -> SrcSpan
-> Maybe (Doc DocName) -> [(DocName, DocForDecl DocName)] -> Maybe (Doc DocName) -> [(DocName, DocForDecl DocName)]
-> TyClDecl DocName -> Bool -> LaTeX -> TyClDecl DocName -> Bool -> LaTeX
ppClassDecl instances loc mbDoc subdocs ppClassDecl instances loc mbDoc subdocs
(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode (ClassDecl lctxt lname ltyvars lfds lsigs _ ats at_defs _) unicode
= declWithDoc classheader (if null body then Nothing else Just (vcat body)) $$ = declWithDoc classheader (if null body then Nothing else Just (vcat body)) $$
instancesBit instancesBit
where where
...@@ -486,8 +486,8 @@ ppClassDecl instances loc mbDoc subdocs ...@@ -486,8 +486,8 @@ ppClassDecl instances loc mbDoc subdocs
body = catMaybes [fmap docToLaTeX mbDoc, body_] body = catMaybes [fmap docToLaTeX mbDoc, body_]
body_ body_
| null lsigs, null ats = Nothing | null lsigs, null ats, null at_defs = Nothing
| null ats = Just methodTable | null ats, null at_defs = Just methodTable
--- | otherwise = atTable $$ methodTable --- | otherwise = atTable $$ methodTable
| otherwise = error "LaTeX.ppClassDecl" | otherwise = error "LaTeX.ppClassDecl"
......
...@@ -352,7 +352,7 @@ ppFds fds unicode qual = ...@@ -352,7 +352,7 @@ ppFds fds unicode qual =
ppShortClassDecl :: Bool -> LinksInfo -> TyClDecl DocName -> SrcSpan ppShortClassDecl :: Bool -> LinksInfo -> TyClDecl DocName -> SrcSpan
-> [(DocName, DocForDecl DocName)] -> Bool -> Qualification -> [(DocName, DocForDecl DocName)] -> Bool -> Qualification
-> Html -> Html
ppShortClassDecl summary links (ClassDecl lctxt lname tvs fds sigs _ ats _) loc ppShortClassDecl summary links (ClassDecl lctxt lname tvs fds sigs _ ats _ _) loc
subdocs unicode qual = subdocs unicode qual =
if null sigs && null ats if null sigs && null ats
then (if summary then id else topDeclElem links loc [nm]) hdr then (if summary then id else topDeclElem links loc [nm]) hdr
...@@ -381,7 +381,7 @@ ppClassDecl :: Bool -> LinksInfo -> [DocInstance DocName] -> SrcSpan ...@@ -381,7 +381,7 @@ ppClassDecl :: Bool -> LinksInfo -> [DocInstance DocName] -> SrcSpan
-> Maybe (Doc DocName) -> [(DocName, DocForDecl DocName)] -> Maybe (Doc DocName) -> [(DocName, DocForDecl DocName)]
-> TyClDecl DocName -> Bool -> Qualification -> Html -> TyClDecl DocName -> Bool -> Qualification -> Html
ppClassDecl summary links instances loc mbDoc subdocs ppClassDecl summary links instances loc mbDoc subdocs
decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _) unicode qual decl@(ClassDecl lctxt lname ltyvars lfds lsigs _ ats _ _) unicode qual
| summary = ppShortClassDecl summary links decl loc subdocs unicode qual | summary = ppShortClassDecl summary links decl loc subdocs unicode qual
| otherwise = classheader +++ maybeDocSection qual mbDoc | otherwise = classheader +++ maybeDocSection qual mbDoc
+++ atBit +++ methodBit +++ instancesBit +++ atBit +++ methodBit +++ instancesBit
......
...@@ -68,14 +68,20 @@ tyThingToLHsDecl t = noLoc $ case t of ...@@ -68,14 +68,20 @@ tyThingToLHsDecl t = noLoc $ case t of
(map (noLoc . synifyIdSig DeleteTopLevelQuantification) (map (noLoc . synifyIdSig DeleteTopLevelQuantification)
(classMethods cl)) (classMethods cl))
emptyBag --ignore default method definitions, they don't affect signature emptyBag --ignore default method definitions, they don't affect signature
(map synifyClassAT (classATs cl)) ats
(concat at_defss)
[] --we don't have any docs at this point [] --we don't have any docs at this point
where (ats, at_defss) = unzip $ map synifyClassAT (classATItems cl)
-- class associated-types are a subset of TyCon -- class associated-types are a subset of TyCon
-- (mainly only type/data-families) -- (mainly only type/data-families)
synifyClassAT :: TyCon -> LTyClDecl Name synifyClassAT :: ClassATItem -> (LTyClDecl Name, [LTyClDecl Name])
synifyClassAT = noLoc . synifyTyCon synifyClassAT (tc, mb_defs) = (noLoc (synifyTyCon tc), maybe [] (map synifyATDefault) mb_defs)
synifyATDefault :: TyCon -> LTyClDecl Name
synifyATDefault tc = noLoc (synifyAxiom ax)
where Just ax = tyConFamilyCoercion_maybe tc
synifyAxiom :: CoAxiom -> TyClDecl Name synifyAxiom :: CoAxiom -> TyClDecl Name
synifyAxiom (CoAxiom { co_ax_tvs = tvs, co_ax_lhs = lhs, co_ax_rhs = rhs }) synifyAxiom (CoAxiom { co_ax_tvs = tvs, co_ax_lhs = lhs, co_ax_rhs = rhs })
......
...@@ -351,15 +351,16 @@ renameTyClD d = case d of ...@@ -351,15 +351,16 @@ renameTyClD d = case d of
typats' <- mapM (mapM renameLType) typats typats' <- mapM (mapM renameLType) typats
return (TySynonym lname' ltyvars' typats' ltype') return (TySynonym lname' ltyvars' typats' ltype')
ClassDecl lcontext lname ltyvars lfundeps lsigs _ ats _ -> do ClassDecl lcontext lname ltyvars lfundeps lsigs _ ats at_defs _ -> do
lcontext' <- renameLContext lcontext lcontext' <- renameLContext lcontext
lname' <- renameL lname lname' <- renameL lname
ltyvars' <- mapM renameLTyVarBndr ltyvars ltyvars' <- mapM renameLTyVarBndr ltyvars
lfundeps' <- mapM renameLFunDep lfundeps lfundeps' <- mapM renameLFunDep lfundeps
lsigs' <- mapM renameLSig lsigs lsigs' <- mapM renameLSig lsigs
ats' <- mapM renameLTyClD ats ats' <- mapM renameLTyClD ats
at_defs' <- mapM renameLTyClD at_defs
-- we don't need the default methods or the already collected doc entities -- we don't need the default methods or the already collected doc entities
return (ClassDecl lcontext' lname' ltyvars' lfundeps' lsigs' emptyBag ats' []) return (ClassDecl lcontext' lname' ltyvars' lfundeps' lsigs' emptyBag ats' at_defs' [])
where where
renameLCon (L loc con) = return . L loc =<< renameCon con renameLCon (L loc con) = return . L loc =<< renameCon con
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment