[commit: ghc] master: Throw error if safe imports used when safe haskell isn't on (c4874d4)

David Terei davidterei at gmail.com
Wed Nov 9 03:01:55 CET 2011


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/c4874d4e1de286128436831d59e92d88022d11e7

>---------------------------------------------------------------

commit c4874d4e1de286128436831d59e92d88022d11e7
Author: David Terei <davidterei at gmail.com>
Date:   Tue Nov 8 17:15:27 2011 -0800

    Throw error if safe imports used when safe haskell isn't on

>---------------------------------------------------------------

 compiler/rename/RnNames.lhs |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs
index 02ed64f..f300a02 100644
--- a/compiler/rename/RnNames.lhs
+++ b/compiler/rename/RnNames.lhs
@@ -214,6 +214,10 @@ rnImportDecl this_mod
     dflags <- getDOpts
     warnIf (want_boot && not (mi_boot iface) && isOneShot (ghcMode dflags))
            (warnRedundantSourceImport imp_mod_name)
+    when (mod_safe && not (safeImportsOn dflags)) $
+        addErrAt loc (ptext (sLit "safe import can't be used as Safe Haskell isn't on!")
+                  $+$ ptext (sLit $ "please enable Safe Haskell through either"
+                                 ++ "-XSafe, -XTruswrothy or -XUnsafe"))
 
     let
         imp_mod    = mi_module iface





More information about the Cvs-ghc mailing list