Commit 34ddd1bc authored by dterei's avatar dterei
Browse files

Remove SafeLanguage from safe haskell

parent 73b98445
......@@ -331,18 +331,14 @@ data Language = Haskell98 | Haskell2010
data SafeHaskellMode
= Sf_None
| Sf_SafeImports
| Sf_SafeLanguage
| Sf_Trustworthy
| Sf_TrustworthyWithSafeLanguage
| Sf_Safe
deriving (Eq)
instance Outputable SafeHaskellMode where
ppr Sf_None = ptext $ sLit "None"
ppr Sf_SafeImports = ptext $ sLit "SafeImports"
ppr Sf_SafeLanguage = ptext $ sLit "SafeLanguage"
ppr Sf_Trustworthy = ptext $ sLit "Trustworthy"
ppr Sf_TrustworthyWithSafeLanguage = ptext $ sLit "Trustworthy + SafeLanguage"
ppr Sf_Safe = ptext $ sLit "Safe"
data ExtensionFlag
......@@ -987,10 +983,7 @@ dynFlagDependencies = pluginModNames
-- | Is the Safe Haskell safe language in use
safeLanguageOn :: DynFlags -> Bool
safeLanguageOn dflags = s == Sf_SafeLanguage
|| s == Sf_TrustworthyWithSafeLanguage
|| s == Sf_Safe
where s = safeHaskell dflags
safeLanguageOn dflags = safeHaskell dflags == Sf_Safe
-- | Test if Safe Haskell is on in some form
safeHaskellOn :: DynFlags -> Bool
......@@ -1027,17 +1020,6 @@ combineSafeFlags a b =
(Sf_SafeImports, sf) -> return sf
(sf, Sf_SafeImports) -> return sf
(Sf_SafeLanguage, Sf_Safe) -> err
(Sf_Safe, Sf_SafeLanguage) -> err
(Sf_SafeLanguage, Sf_Trustworthy) -> return Sf_TrustworthyWithSafeLanguage
(Sf_Trustworthy, Sf_SafeLanguage) -> return Sf_TrustworthyWithSafeLanguage
(Sf_TrustworthyWithSafeLanguage, Sf_Trustworthy) -> return Sf_TrustworthyWithSafeLanguage
(Sf_TrustworthyWithSafeLanguage, Sf_SafeLanguage) -> return Sf_TrustworthyWithSafeLanguage
(Sf_Trustworthy, Sf_TrustworthyWithSafeLanguage) -> return Sf_TrustworthyWithSafeLanguage
(Sf_SafeLanguage, Sf_TrustworthyWithSafeLanguage) -> return Sf_TrustworthyWithSafeLanguage
(Sf_Trustworthy, Sf_Safe) -> err
(Sf_Safe, Sf_Trustworthy) -> err
......@@ -1801,8 +1783,7 @@ languageFlags = [
-- They are used to place hard requirements on what GHC Haskell language
-- features can be used.
safeHaskellFlags :: [FlagSpec SafeHaskellMode]
safeHaskellFlags = [mkF Sf_SafeImports, mkF' Sf_SafeLanguage,
mkF Sf_Trustworthy, mkF' Sf_Safe]
safeHaskellFlags = [mkF Sf_SafeImports, mkF Sf_Trustworthy, mkF' Sf_Safe]
where mkF flag = (showPpr flag, AlwaysAllowed, flag, nop)
mkF' flag = (showPpr flag, EnablesSafe, flag, nop)
......
......@@ -925,8 +925,7 @@ checkSafeImports dflags hsc_env tcg_env
let trust = getSafeMode $ mi_trust iface'
trust_own_pkg = mi_trust_pkg iface'
-- check module is trusted
safeM = trust `elem` [Sf_Safe, Sf_Trustworthy,
Sf_TrustworthyWithSafeLanguage]
safeM = trust `elem` [Sf_Safe, Sf_Trustworthy]
-- check package is trusted
safeP = packageTrusted trust trust_own_pkg m
if safeM && safeP
......
......@@ -1856,27 +1856,20 @@ trustInfoToNum it
= case getSafeMode it of
Sf_None -> 0
Sf_SafeImports -> 1
Sf_SafeLanguage -> 2
Sf_Trustworthy -> 3
Sf_TrustworthyWithSafeLanguage -> 4
Sf_Safe -> 5
Sf_Trustworthy -> 2
Sf_Safe -> 3
numToTrustInfo :: Word8 -> IfaceTrustInfo
numToTrustInfo 0 = setSafeMode Sf_None
numToTrustInfo 1 = setSafeMode Sf_SafeImports
numToTrustInfo 2 = setSafeMode Sf_SafeLanguage
numToTrustInfo 3 = setSafeMode Sf_Trustworthy
numToTrustInfo 4 = setSafeMode Sf_TrustworthyWithSafeLanguage
numToTrustInfo 5 = setSafeMode Sf_Safe
numToTrustInfo 2 = setSafeMode Sf_Trustworthy
numToTrustInfo 3 = setSafeMode Sf_Safe
numToTrustInfo n = error $ "numToTrustInfo: bad input number! (" ++ show n ++ ")"
instance Outputable IfaceTrustInfo where
ppr (TrustInfo Sf_None) = ptext $ sLit "none"
ppr (TrustInfo Sf_SafeImports) = ptext $ sLit "safe-imports"
ppr (TrustInfo Sf_SafeLanguage) = ptext $ sLit "safe-language"
ppr (TrustInfo Sf_Trustworthy) = ptext $ sLit "trustworthy"
ppr (TrustInfo Sf_TrustworthyWithSafeLanguage)
= ptext $ sLit "trustworthy + safe-language"
ppr (TrustInfo Sf_Safe) = ptext $ sLit "safe"
\end{code}
......
......@@ -277,9 +277,7 @@ rnImportDecl this_mod implicit_prelude
-- Does this import mean we now require our own pkg
-- to be trusted? See Note [Trust Own Package]
ptrust = trust == Sf_Trustworthy
|| trust == Sf_TrustworthyWithSafeLanguage
|| trust_pkg
ptrust = trust == Sf_Trustworthy || trust_pkg
(dependent_mods, dependent_pkgs, pkg_trust_req)
| pkg == thisPackage dflags =
......
Supports Markdown
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