diff options
Diffstat (limited to 'compiler/GHC/Driver/Main.hs')
-rw-r--r-- | compiler/GHC/Driver/Main.hs | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/compiler/GHC/Driver/Main.hs b/compiler/GHC/Driver/Main.hs index 393c31fa0b..a910cdf23f 100644 --- a/compiler/GHC/Driver/Main.hs +++ b/compiler/GHC/Driver/Main.hs @@ -141,7 +141,6 @@ import GHC.Core.FamInstEnv import GHC.CoreToStg.Prep import GHC.CoreToStg ( coreToStg ) -import GHC.Parser.Annotation import GHC.Parser.Errors import GHC.Parser.Errors.Ppr import GHC.Parser @@ -216,14 +215,13 @@ import qualified GHC.Data.Stream as Stream import GHC.Data.Stream (Stream) import Data.Data hiding (Fixity, TyCon) -import Data.Maybe ( fromJust ) +import Data.Maybe ( fromJust, fromMaybe ) import Data.List ( nub, isPrefixOf, partition ) import Control.Monad import Data.IORef import System.FilePath as FilePath import System.Directory import System.IO (fixIO) -import qualified Data.Map as M import qualified Data.Set as S import Data.Set (Set) import Data.Functor @@ -353,7 +351,7 @@ ioMsgMaybe' ioA = do -- ----------------------------------------------------------------------------- -- | Lookup things in the compiler's environment -hscTcRnLookupRdrName :: HscEnv -> Located RdrName -> IO [Name] +hscTcRnLookupRdrName :: HscEnv -> LocatedN RdrName -> IO [Name] hscTcRnLookupRdrName hsc_env0 rdr_name = runInteractiveHsc hsc_env0 $ do { hsc_env <- getHscEnv @@ -431,7 +429,9 @@ hscParse' mod_summary liftIO $ dumpIfSet_dyn logger dflags Opt_D_dump_parsed "Parser" FormatHaskell (ppr rdr_module) liftIO $ dumpIfSet_dyn logger dflags Opt_D_dump_parsed_ast "Parser AST" - FormatHaskell (showAstData NoBlankSrcSpan rdr_module) + FormatHaskell (showAstData NoBlankSrcSpan + NoBlankApiAnnotations + rdr_module) liftIO $ dumpIfSet_dyn logger dflags Opt_D_source_stats "Source Statistics" FormatText (ppSourceStats False rdr_module) when (not $ isEmptyBag errs) $ throwErrors errs @@ -463,10 +463,7 @@ hscParse' mod_summary srcs2 <- liftIO $ filterM doesFileExist srcs1 let api_anns = ApiAnns { - apiAnnItems = M.fromListWith (++) $ annotations pst, - apiAnnEofPos = eof_pos pst, - apiAnnComments = M.fromList (annotations_comments pst), - apiAnnRogueComments = comment_q pst + apiAnnRogueComments = (fromMaybe [] (header_comments pst)) ++ comment_q pst } res = HsParsedModule { hpm_module = rdr_module, @@ -490,7 +487,7 @@ extract_renamed_stuff mod_summary tc_result = do dflags <- getDynFlags logger <- getLogger liftIO $ dumpIfSet_dyn logger dflags Opt_D_dump_rn_ast "Renamer" - FormatHaskell (showAstData NoBlankSrcSpan rn_info) + FormatHaskell (showAstData NoBlankSrcSpan NoBlankApiAnnotations rn_info) -- Create HIE files when (gopt Opt_WriteHie dflags) $ do @@ -1158,9 +1155,9 @@ hscCheckSafeImports tcg_env = do warns rules = listToBag $ map warnRules rules - warnRules :: GenLocated SrcSpan (RuleDecl GhcTc) -> MsgEnvelope DecoratedSDoc + warnRules :: LRuleDecl GhcTc -> MsgEnvelope DecoratedSDoc warnRules (L loc (HsRule { rd_name = n })) = - mkPlainWarnMsg loc $ + mkPlainWarnMsg (locA loc) $ text "Rule \"" <> ftext (snd $ unLoc n) <> text "\" ignored" $+$ text "User defined rules are disabled under Safe Haskell" @@ -2021,7 +2018,7 @@ hscParseStmtWithLocation source linenumber stmt = hscParseType :: String -> Hsc (LHsType GhcPs) hscParseType = hscParseThing parseType -hscParseIdentifier :: HscEnv -> String -> IO (Located RdrName) +hscParseIdentifier :: HscEnv -> String -> IO (LocatedN RdrName) hscParseIdentifier hsc_env str = runInteractiveHsc hsc_env $ hscParseThing parseIdentifier str @@ -2049,7 +2046,7 @@ hscParseThingWithLocation source linenumber parser str = do liftIO $ dumpIfSet_dyn logger dflags Opt_D_dump_parsed "Parser" FormatHaskell (ppr thing) liftIO $ dumpIfSet_dyn logger dflags Opt_D_dump_parsed_ast "Parser AST" - FormatHaskell (showAstData NoBlankSrcSpan thing) + FormatHaskell (showAstData NoBlankSrcSpan NoBlankApiAnnotations thing) return thing |