[commit: ghc] master: Revert "ghc: Remove warning of StaticPointers not being supported by GHCi" (7ab8007)

git at git.haskell.org git at git.haskell.org
Wed Sep 12 22:06:58 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7ab80072ad63fa9eb1d77bd579af720bf24b25a4/ghc

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

commit 7ab80072ad63fa9eb1d77bd579af720bf24b25a4
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Fri Sep 7 10:48:43 2018 -0400

    Revert "ghc: Remove warning of StaticPointers not being supported by GHCi"
    
    While we now support use of StaticPointers in modules loaded via the
    REPL (e.g. via `:load`), we currently do not support use of
    StaticPointers on the REPL itself.
    
    This reverts commit 9400a5c6b308fbb5b3a73690610736ca3b5eb0b3.


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

7ab80072ad63fa9eb1d77bd579af720bf24b25a4
 compiler/main/GHC.hs                          | 15 ++++++++++++---
 testsuite/tests/ghci/scripts/StaticPtr.stderr |  3 +++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index 4059860..cf9c74f 100644
--- a/compiler/main/GHC.hs
+++ b/compiler/main/GHC.hs
@@ -332,7 +332,7 @@ import Annotations
 import Module
 import Panic
 import Platform
-import Bag              ( unitBag )
+import Bag              ( listToBag, unitBag )
 import ErrUtils
 import MonadUtils
 import Util
@@ -344,6 +344,7 @@ import FastString
 import qualified Parser
 import Lexer
 import ApiAnnotation
+import qualified GHC.LanguageExtensions as LangExt
 import NameEnv
 import CoreFVs          ( orphNamesOfFamInst )
 import FamInstEnv       ( famInstEnvElts )
@@ -676,8 +677,16 @@ checkNewDynFlags dflags = do
 
 checkNewInteractiveDynFlags :: MonadIO m => DynFlags -> m DynFlags
 checkNewInteractiveDynFlags dflags0 = do
-  -- Nothing to be done here
-  return dflags0
+  -- We currently don't support use of StaticPointers in expressions entered on
+  -- the REPL. See #12356.
+  dflags1 <-
+      if xopt LangExt.StaticPointers dflags0
+      then do liftIO $ printOrThrowWarnings dflags0 $ listToBag
+                [mkPlainWarnMsg dflags0 interactiveSrcSpan
+                 $ text "StaticPointers is not supported in GHCi interactive expressions."]
+              return $ xopt_unset dflags0 LangExt.StaticPointers
+      else return dflags0
+  return dflags1
 
 
 -- %************************************************************************
diff --git a/testsuite/tests/ghci/scripts/StaticPtr.stderr b/testsuite/tests/ghci/scripts/StaticPtr.stderr
new file mode 100644
index 0000000..b45f64e
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/StaticPtr.stderr
@@ -0,0 +1,3 @@
+
+<interactive>: warning:
+    StaticPointers is not supported in GHCi interactive expressions.



More information about the ghc-commits mailing list