[Git][ghc/ghc][wip/haddock-mem-fixes] Fix associated data family doc structure items

Finley McIlwaine (@FinleyMcIlwaine) gitlab at gitlab.haskell.org
Thu Jun 1 14:54:35 UTC 2023



Finley McIlwaine pushed to branch wip/haddock-mem-fixes at Glasgow Haskell Compiler / GHC


Commits:
c3fea031 by Finley McIlwaine at 2023-06-01T08:54:22-06:00
Fix associated data family doc structure items

Associated data families were being given their own export DocStructureItems,
which resulted in them being documented separately from their classes in
haddocks. This commit fixes it.

Also bump haddock to latest dev commit.

- - - - -


3 changed files:

- compiler/GHC/Hs/Doc.hs
- compiler/GHC/HsToCore/Docs.hs
- utils/haddock


Changes:

=====================================
compiler/GHC/Hs/Doc.hs
=====================================
@@ -123,7 +123,7 @@ type LHsDoc pass = Located (HsDoc pass)
 data DocStructureItem
   = DsiSectionHeading !Int !(HsDoc GhcRn)
   | DsiDocChunk !(HsDoc GhcRn)
-  | DsiNamedChunkRef !(String)
+  | DsiNamedChunkRef !String
   | DsiExports !Avails
   | DsiModExport
       !(NonEmpty ModuleName) -- ^ We might re-export avails from multiple


=====================================
compiler/GHC/HsToCore/Docs.hs
=====================================
@@ -31,18 +31,18 @@ import Data.Bifunctor (first)
 import Data.Foldable (toList)
 import Data.IntMap (IntMap)
 import qualified Data.IntMap as IM
+import qualified Data.List.NonEmpty as NonEmpty
+import Data.List.NonEmpty (NonEmpty ((:|)))
 import Data.Map.Strict (Map)
 import qualified Data.Map as M
-import qualified Data.Set as Set
 import Data.Maybe
+import qualified Data.Set as Set
 import Data.Semigroup
 import GHC.IORef (readIORef)
 import GHC.Unit.Types
 import GHC.Hs
 import GHC.Types.Avail
 import GHC.Unit.Module
-import qualified Data.List.NonEmpty as NonEmpty
-import Data.List.NonEmpty (NonEmpty ((:|)))
 import GHC.Unit.Module.Imported
 import GHC.Driver.DynFlags
 import GHC.Types.TypeEnv
@@ -192,7 +192,13 @@ mkDocStructureFromDecls env all_exports decls =
         Just loc -> L loc (DsiExports [avail])
         -- FIXME: This is just a workaround that we use when handling e.g.
         -- associated data families like in the html-test Instances.hs.
-        Nothing -> noLoc (DsiExports [avail])
+        Nothing -> noLoc (DsiExports [])
+
+        -- This causes the associated data family to be incorrectly documented
+        -- separately from its class:
+        -- Nothing -> noLoc (DsiExports [])
+
+        -- This panics on the associated data family:
         -- Nothing -> panicDoc "mkDocStructureFromDecls: No loc found for"
         --                     (ppr avail)
 


=====================================
utils/haddock
=====================================
@@ -1 +1 @@
-Subproject commit 3b113471906b1d383727227cf0da16f358b3e1f1
+Subproject commit daa07b2027a187f7d05148b66e3fe62acdcb2ba8



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c3fea031c98ea273ba2ff34b68511390b468791b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c3fea031c98ea273ba2ff34b68511390b468791b
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230601/447154c0/attachment-0001.html>


More information about the ghc-commits mailing list