From 853397a9c62f906f5c8b4dc889c97ad2823f9c07 Mon Sep 17 00:00:00 2001 From: David Terei Date: Tue, 3 Apr 2012 17:58:02 -0700 Subject: Fix reporting of modules safe haskell mode (#5989) --- src/Haddock/Interface/Create.hs | 3 ++- src/Haddock/Interface/LexParseRn.hs | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') 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) -- cgit v1.2.3