aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2012-04-03 17:58:02 -0700
committerDavid Terei <davidterei@gmail.com>2012-04-04 15:08:21 -0700
commit853397a9c62f906f5c8b4dc889c97ad2823f9c07 (patch)
treef899cff780e1d527ea1cbc542eee20129c6b00e7 /src
parent0a9b99a0c916100e7087026d29253d72f1ff9057 (diff)
Fix reporting of modules safe haskell mode (#5989)
Diffstat (limited to 'src')
-rw-r--r--src/Haddock/Interface/Create.hs3
-rw-r--r--src/Haddock/Interface/LexParseRn.hs8
2 files changed, 6 insertions, 5 deletions
diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs
index 5029dce8..608928b2 100644
--- a/src/Haddock/Interface/Create.hs
+++ b/src/Haddock/Interface/Create.hs
@@ -45,6 +45,7 @@ createInterface tm flags modMap instIfaceMap = do
let ms = pm_mod_summary . tm_parsed_module $ tm
mi = moduleInfo tm
+ safety = modInfoSafe mi
mdl = ms_mod ms
dflags = ms_hspp_opts ms
instances = modInfoInstances mi
@@ -68,7 +69,7 @@ createInterface tm flags modMap instIfaceMap = do
| Flag_IgnoreAllExports `elem` flags = OptIgnoreExports : opts0
| otherwise = opts0
- (info, mbDoc) <- liftErrMsg $ lexParseRnHaddockModHeader dflags gre mayDocHeader
+ (info, mbDoc) <- liftErrMsg $ lexParseRnHaddockModHeader dflags gre safety mayDocHeader
let declsWithDocs = topDecls group_
(decls, _) = unzip declsWithDocs
diff --git a/src/Haddock/Interface/LexParseRn.hs b/src/Haddock/Interface/LexParseRn.hs
index f70c5953..27a52ea2 100644
--- a/src/Haddock/Interface/LexParseRn.hs
+++ b/src/Haddock/Interface/LexParseRn.hs
@@ -67,8 +67,9 @@ lexParseRnMbHaddockComment dflags hty gre (Just d) = lexParseRnHaddockComment df
-- yes, you always get a HaddockModInfo though it might be empty
-lexParseRnHaddockModHeader :: DynFlags -> GlobalRdrEnv -> GhcDocHdr -> ErrMsgM (HaddockModInfo Name, Maybe (Doc Name))
-lexParseRnHaddockModHeader dflags gre mbStr = do
+lexParseRnHaddockModHeader :: DynFlags -> GlobalRdrEnv -> SafeHaskellMode -> GhcDocHdr
+ -> ErrMsgM (HaddockModInfo Name, Maybe (Doc Name))
+lexParseRnHaddockModHeader dflags gre safety mbStr = do
(hmi, docn) <-
case mbStr of
Nothing -> return failure
@@ -79,9 +80,8 @@ lexParseRnHaddockModHeader dflags gre mbStr = do
tell ["haddock module header parse failed: " ++ mess]
return failure
Right (info, doc) -> return (renameHmi gre info, Just (rename gre doc))
- return (hmi { hmi_safety = safety }, docn)
+ return (hmi { hmi_safety = Just $ showPpr safety }, docn)
where
- safety = Just $ showPpr $ safeHaskell dflags
failure = (emptyHaddockModInfo, Nothing)