[commit: haddock] 2.17.3.1-spanfix, alexbiehl-patch-1, ghc-8.0, ghc-8.0-facebook, ghc-head, ghc-head1, haddock-quick, headdock-library-1.4.5, ie_avails, issue-303, issue-475, master, pr-filter-maps, pr/cabal-desc, travis, v2.17, v2.17.3, v2.18, wip-located-module-as, wip/D2418, wip/T11080-open-data-kinds, wip/T11430, wip/T12105, wip/T12105-2, wip/T12942, wip/T13163, wip/T3384, wip/embelleshed-rdr, wip/new-tree-one-param, wip/rae, wip/remove-frames, wip/remove-frames1, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13: Merge remote-tracking branch 'phadej/orphans' into ghc-head (19692aa)

git at git.haskell.org git at git.haskell.org
Mon Nov 20 20:58:37 UTC 2017


Repository : ssh://git@git.haskell.org/haddock

On branches: 2.17.3.1-spanfix,alexbiehl-patch-1,ghc-8.0,ghc-8.0-facebook,ghc-head,ghc-head1,haddock-quick,headdock-library-1.4.5,ie_avails,issue-303,issue-475,master,pr-filter-maps,pr/cabal-desc,travis,v2.17,v2.17.3,v2.18,wip-located-module-as,wip/D2418,wip/T11080-open-data-kinds,wip/T11430,wip/T12105,wip/T12105-2,wip/T12942,wip/T13163,wip/T3384,wip/embelleshed-rdr,wip/new-tree-one-param,wip/rae,wip/remove-frames,wip/remove-frames1,wip/revert-ttg-2017-11-20,wip/ttg-2017-10-13,wip/ttg-2017-10-31,wip/ttg-2017-11-06,wip/ttg2-2017-11-10,wip/ttg3-2017-11-12,wip/ttg4-constraints-2017-11-13
Link       : http://git.haskell.org/haddock.git/commitdiff/19692aab1913730fc10ffda515b77db7308bcf11

>---------------------------------------------------------------

commit 19692aab1913730fc10ffda515b77db7308bcf11
Merge: edb3feb 52bc03a
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sun Dec 20 01:14:35 2015 +0100

    Merge remote-tracking branch 'phadej/orphans' into ghc-head



>---------------------------------------------------------------

19692aab1913730fc10ffda515b77db7308bcf11
 haddock-api/src/Haddock/Backends/Xhtml.hs          | 23 ++++++++++-----
 haddock-api/src/Haddock/Backends/Xhtml/Decl.hs     | 33 +++++++++++++++++-----
 haddock-api/src/Haddock/Backends/Xhtml/Layout.hs   | 12 +++++++-
 haddock-api/src/Haddock/Interface.hs               |  2 +-
 .../src/Haddock/Interface/AttachInstances.hs       | 13 ++++++++-
 haddock-api/src/Haddock/Interface/Create.hs        |  2 ++
 haddock-api/src/Haddock/Interface/Rename.hs        | 26 +++++++++++------
 haddock-api/src/Haddock/Types.hs                   |  4 +++
 8 files changed, 89 insertions(+), 26 deletions(-)

diff --cc haddock-api/src/Haddock/Interface/AttachInstances.hs
index faf043a,5adee45..2097107
--- a/haddock-api/src/Haddock/Interface/AttachInstances.hs
+++ b/haddock-api/src/Haddock/Interface/AttachInstances.hs
@@@ -60,7 -61,18 +60,18 @@@ attachInstances expInfo ifaces instIfac
      attach iface = do
        newItems <- mapM (attachToExportItem expInfo iface ifaceMap instIfaceMap)
                         (ifaceExportItems iface)
-       return $ iface { ifaceExportItems = newItems }
+       let orphanInstances = attachOrphanInstances expInfo iface ifaceMap instIfaceMap (ifaceInstances iface)
+       return $ iface { ifaceExportItems = newItems
+                      , ifaceOrphanInstances = orphanInstances
+                      }
+ 
+ attachOrphanInstances :: ExportInfo -> Interface -> IfaceMap -> InstIfaceMap -> [ClsInst] -> [DocInstance Name]
+ attachOrphanInstances expInfo iface ifaceMap instIfaceMap cls_instances =
+   [ (synifyInstHead i, instLookup instDocMap n iface ifaceMap instIfaceMap, (L (getSrcSpan n) n))
 -  | let is = [ (instanceHead' i, getName i) | i <- cls_instances, isOrphan (is_orphan i) ]
++  | let is = [ (instanceSig i, getName i) | i <- cls_instances, isOrphan (is_orphan i) ]
+   , (i@(_,_,cls,tys), n) <- sortBy (comparing $ first instHead) is
+   , not $ isInstanceHidden expInfo cls tys
+   ]
  
  
  attachToExportItem :: ExportInfo -> Interface -> IfaceMap -> InstIfaceMap
diff --cc haddock-api/src/Haddock/Interface/Rename.hs
index 2478ce2,dde8128..a622344
--- a/haddock-api/src/Haddock/Interface/Rename.hs
+++ b/haddock-api/src/Haddock/Interface/Rename.hs
@@@ -51,9 -54,9 +54,10 @@@ renameInterface dflags renamingEnv warn
          = runRnFM localEnv (renameDocumentation (ifaceDoc iface))
  
        -- combine the missing names and filter out the built-ins, which would
-       -- otherwise allways be missing.
+       -- otherwise always be missing.
        missingNames = nub $ filter isExternalName  -- XXX: isExternalName filters out too much
-                     (missingNames1 ++ missingNames2 ++ missingNames3 ++ missingNames4)
 -                    (missingNames1 ++ missingNames2 ++ missingNames3 ++ missingNames4 ++ missingNames5)
++                    (missingNames1 ++ missingNames2 ++ missingNames3
++                     ++ missingNames4 ++ missingNames5)
  
        -- filter out certain built in type constructors using their string
        -- representation. TODO: use the Name constants from the GHC API.
@@@ -537,30 -499,22 +542,37 @@@ renameLTyFamDefltEqn (L loc (TyFamEqn 
                                   , tfe_rhs = rhs' })) }
  
  renameDataFamInstD :: DataFamInstDecl Name -> RnM (DataFamInstDecl DocName)
 -renameDataFamInstD (DataFamInstDecl { dfid_tycon = tc, dfid_pats = pats_w_bndrs, dfid_defn = defn })
 +renameDataFamInstD (DataFamInstDecl { dfid_tycon = tc, dfid_pats = pats, dfid_defn = defn })
    = do { tc' <- renameL tc
 -       ; pats' <- mapM renameLType (hswb_cts pats_w_bndrs)
 +       ; pats' <- renameImplicit (mapM renameLType) pats
         ; defn' <- renameDataDefn defn
         ; return (DataFamInstDecl { dfid_tycon = tc'
 -                                 , dfid_pats
 -                                       = HsWB pats' PlaceHolder PlaceHolder PlaceHolder
 +                                 , dfid_pats = pats'
                                   , dfid_defn = defn', dfid_fvs = placeHolderNames }) }
  
 +renameImplicit :: (in_thing -> RnM out_thing)
 +               -> HsImplicitBndrs Name in_thing
 +               -> RnM (HsImplicitBndrs DocName out_thing)
 +renameImplicit rn_thing (HsIB { hsib_body = thing })
 +  = do { thing' <- rn_thing thing
 +       ; return (HsIB { hsib_body = thing'
 +                      , hsib_vars = PlaceHolder }) }
 +
 +renameWc :: (in_thing -> RnM out_thing)
 +         -> HsWildCardBndrs Name in_thing
 +         -> RnM (HsWildCardBndrs DocName out_thing)
 +renameWc rn_thing (HsWC { hswc_body = thing })
 +  = do { thing' <- rn_thing thing
 +       ; return (HsWC { hswc_body = thing'
 +                      , hswc_wcs = PlaceHolder, hswc_ctx = Nothing }) }
 +
+ renameDocInstance :: DocInstance Name -> RnM (DocInstance DocName)
+ renameDocInstance (inst, idoc, L l n) = do
+   inst' <- renameInstHead inst
+   n' <- rename n
+   idoc' <- mapM renameDoc idoc
+   return (inst', idoc',L l n')
+ 
  renameExportItem :: ExportItem Name -> RnM (ExportItem DocName)
  renameExportItem item = case item of
    ExportModule mdl -> return (ExportModule mdl)



More information about the ghc-commits mailing list