Commit f142a2cf authored by dterei's avatar dterei

Fix some validation errors

Conflicts:

	compiler/main/DynFlags.hs
	compiler/main/HscMain.lhs
parent 20b30496
......@@ -1029,6 +1029,10 @@ packageTrustOn = dopt Opt_PackageTrust
safeLanguageOn :: DynFlags -> Bool
safeLanguageOn dflags = safeHaskell dflags == Sf_Safe
-- | Is the Safe Haskell safe inference mode active
safeInferOn :: DynFlags -> Bool
safeInferOn dflags = safeHaskell dflags == Sf_SafeInfered
-- | Test if Safe Imports are on in some form
safeImportsOn :: DynFlags -> Bool
safeImportsOn dflags = safeHaskell dflags == Sf_Unsafe ||
......
......@@ -886,6 +886,20 @@ checkSafeImports dflags hsc_env tcg_env
= do
imps <- mapM condense imports'
pkgs <- mapM checkSafe imps
-- grab any safe haskell specific errors and restore old warnings
errs <- getWarnings
clearWarnings
logWarnings oldErrs
-- See the Note [ Safe Haskell Inference]
when (not $ isEmptyBag errs) (
-- did we fail safe inference or fail -XSafe?
case safeInferOn dflags of
True -> setDynFlags (dflags { safeHaskell = Sf_None } )
False -> liftIO . throwIO . mkSrcErr $ errs
)
when (packageTrustOn dflags) $ checkPkgTrust pkg_reqs
-- add in trusted package requirements for this module
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment