[commit: haddock] master: Fix bug with module name being hyperlinked to `Prelude`. (0e1cad7)
git at git.haskell.org
git at git.haskell.org
Wed Jul 8 08:43:08 UTC 2015
Repository : ssh://git@git.haskell.org/haddock
On branch : master
Link : http://git.haskell.org/haddock.git/commitdiff/0e1cad7c38ed1a771794d9332233f784a52d2c1a
>---------------------------------------------------------------
commit 0e1cad7c38ed1a771794d9332233f784a52d2c1a
Author: Łukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date: Mon Jul 6 18:07:20 2015 +0200
Fix bug with module name being hyperlinked to `Prelude`.
>---------------------------------------------------------------
0e1cad7c38ed1a771794d9332233f784a52d2c1a
haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs | 7 ++++---
haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs | 1 +
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
index 28fdc3f..71b7366 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
@@ -146,7 +146,7 @@ decls (group, _, _, _) = concatMap ($ group)
-- import lists.
imports :: GHC.RenamedSource -> DetailsMap
imports src@(_, imps, _, _) =
- everything (<|>) ie src ++ map (imp . GHC.unLoc) imps
+ everything (<|>) ie src ++ mapMaybe (imp . GHC.unLoc) imps
where
ie term = case cast term of
(Just (GHC.IEVar v)) -> pure $ var v
@@ -156,9 +156,10 @@ imports src@(_, imps, _, _) =
_ -> empty
typ (GHC.L sspan name) = (sspan, RtkType name)
var (GHC.L sspan name) = (sspan, RtkVar name)
- imp idecl =
+ imp idecl | not . GHC.ideclImplicit $ idecl =
let (GHC.L sspan name) = GHC.ideclName idecl
- in (sspan, RtkModule name)
+ in Just (sspan, RtkModule name)
+ imp _ = Nothing
-- | Check whether token stream span matches GHC source span.
--
diff --git a/haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs b/haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs
index a76bdcd..8cd2690 100644
--- a/haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs
+++ b/haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs
@@ -5,6 +5,7 @@ import Test.Hspec
import Test.QuickCheck
import Haddock.Backends.Hyperlinker.Parser
+import Haddock.Backends.Hyperlinker.Types
main :: IO ()
More information about the ghc-commits
mailing list