summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-06-13 23:51:24 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-06-18 16:00:56 -0400
commit29ec33cd3ee390e8006a88d34f5ea0ac236663d0 (patch)
treedc3970262d7009195f3a07d72c9dd0267368ddfa
parentdbf9ca2040c71b2f04322b054322a0ede1e1b700 (diff)
downloadhaskell-29ec33cd3ee390e8006a88d34f5ea0ac236663d0.tar.gz
SafeHaskell: Don't throw -Wsafe warning if module is declared Safe
Fixes #16689.
-rw-r--r--compiler/main/HscMain.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
index a99fde706e..1960193358 100644
--- a/compiler/main/HscMain.hs
+++ b/compiler/main/HscMain.hs
@@ -520,7 +520,9 @@ tcRnModule' sum save_rn_syntax mod = do
safe <- liftIO $ fst <$> readIORef (tcg_safeInfer tcg_res')
when safe $ do
case wopt Opt_WarnSafe dflags of
- True -> (logWarnings $ unitBag $
+ True
+ | safeHaskell dflags == Sf_Safe -> return ()
+ | otherwise -> (logWarnings $ unitBag $
makeIntoWarning (Reason Opt_WarnSafe) $
mkPlainWarnMsg dflags (warnSafeOnLoc dflags) $
errSafe tcg_res')