summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-06-06 13:45:46 -0700
committerDavid Terei <davidterei@gmail.com>2011-06-17 20:40:34 -0700
commitc838658103c644ef6c32e92025b1d4999aa0f9bd (patch)
treed38d76f235e20fb76f8321bd060fe57b45216c43 /ghc
parent4f9675b2e0533000aeda861f3b4c04dd9ad79970 (diff)
downloadhaskell-c838658103c644ef6c32e92025b1d4999aa0f9bd.tar.gz
SafeHaskell: Fix validation errors when unsafe base used
Diffstat (limited to 'ghc')
-rw-r--r--ghc/InteractiveUI.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 7f95125331..b4fc2aa821 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -88,7 +88,7 @@ import Data.Char
import Data.Array
import Control.Monad as Monad
import Text.Printf
-import Foreign
+import Foreign.Safe
import GHC.Exts ( unsafeCoerce# )
import GHC.IO.Exception ( IOErrorType(InvalidArgument) )
@@ -1336,7 +1336,10 @@ isSafeCmd m =
-- recently-added module occurs last, it seems.
case (as,bs) of
(as@(_:_), _) -> isSafeModule $ last as
- ([], bs@(_:_)) -> isSafeModule $ fst (last bs)
+ ([], bs@(_:_)) -> do
+ let i = last bs
+ m <- GHC.findModule (unLoc (ideclName i)) (ideclPkgQual i)
+ isSafeModule m
([], []) -> ghcError (CmdLineError ":issafe: no current module")
_ -> ghcError (CmdLineError "syntax: :issafe <module>")