summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2021-11-19 14:21:58 +0530
committerZubin Duggal <zubin.duggal@gmail.com>2022-03-30 17:01:11 +0530
commit079be2c88032e2551c356bee273c301b29281135 (patch)
treec4dfcec53f77ea93d78563004ad3b38475b60ddb /utils
parent21894a6318e0daffa0e34041855c3c73ad1f5b6f (diff)
downloadhaskell-wip/parse-errs.tar.gz
Add warnings for file header pragmas that appear in the body of a module (#20385)wip/parse-errs
Once we are done parsing the header of a module to obtain the options, we look through the rest of the tokens in order to determine if they contain any misplaced file header pragmas that would usually be ignored, potentially resulting in bad error messages. The warnings are reported immediately so that later errors don't shadow over potentially helpful warnings. Metric Increase: T13719
Diffstat (limited to 'utils')
-rw-r--r--utils/check-exact/Parsers.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/check-exact/Parsers.hs b/utils/check-exact/Parsers.hs
index cff37bf309..b592a4cee4 100644
--- a/utils/check-exact/Parsers.hs
+++ b/utils/check-exact/Parsers.hs
@@ -305,7 +305,7 @@ initDynFlags :: GHC.GhcMonad m => FilePath -> m GHC.DynFlags
initDynFlags file = do
dflags0 <- GHC.getSessionDynFlags
let parser_opts0 = GHC.initParserOpts dflags0
- src_opts <- GHC.liftIO $ GHC.getOptionsFromFile parser_opts0 file
+ (_, src_opts) <- GHC.liftIO $ GHC.getOptionsFromFile parser_opts0 file
(dflags1, _, _) <- GHC.parseDynamicFilePragma dflags0 src_opts
-- Turn this on last to avoid T10942
let dflags2 = dflags1 `GHC.gopt_set` GHC.Opt_KeepRawTokenStream
@@ -332,7 +332,7 @@ initDynFlagsPure fp s = do
-- no reason to use it.
dflags0 <- GHC.getSessionDynFlags
let parser_opts0 = GHC.initParserOpts dflags0
- let pragmaInfo = GHC.getOptions parser_opts0 (GHC.stringToStringBuffer $ s) fp
+ let (_, pragmaInfo) = GHC.getOptions parser_opts0 (GHC.stringToStringBuffer $ s) fp
(dflags1, _, _) <- GHC.parseDynamicFilePragma dflags0 pragmaInfo
-- Turn this on last to avoid T10942
let dflags2 = dflags1 `GHC.gopt_set` GHC.Opt_KeepRawTokenStream