[commit: ghc] wip/T16254: Fix #12509: ghci -XSafe fails in an inscrutable way (7cdcd3e)
git at git.haskell.org
git at git.haskell.org
Wed Jan 30 00:26:05 UTC 2019
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/T16254
Link : http://ghc.haskell.org/trac/ghc/changeset/7cdcd3e12a5c3a337e36fa80c64bd72e5ef79b24/ghc
>---------------------------------------------------------------
commit 7cdcd3e12a5c3a337e36fa80c64bd72e5ef79b24
Author: Roland Senn <rsx at bluewin.ch>
Date: Mon Jan 28 10:53:50 2019 +0100
Fix #12509: ghci -XSafe fails in an inscrutable way
>---------------------------------------------------------------
7cdcd3e12a5c3a337e36fa80c64bd72e5ef79b24
ghc/GHCi/UI/Monad.hs | 13 +++++++++----
.../tests/safeHaskell/ghci/T12509.script | 0
testsuite/tests/safeHaskell/ghci/all.T | 1 +
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/ghc/GHCi/UI/Monad.hs b/ghc/GHCi/UI/Monad.hs
index 8f60dfb..dddbe82 100644
--- a/ghc/GHCi/UI/Monad.hs
+++ b/ghc/GHCi/UI/Monad.hs
@@ -511,10 +511,15 @@ compileGHCiExpr expr =
withTempSession mkTempSession $ GHC.compileExprRemote expr
where
mkTempSession hsc_env = hsc_env
- { hsc_dflags = (hsc_dflags hsc_env)
- -- RebindableSyntax can wreak havoc with GHCi in several ways
- -- (see #13385 and #14342 for examples), so we take care to disable it
- -- for the duration of running expressions that are internal to GHCi.
+ { hsc_dflags = (hsc_dflags hsc_env) {
+ -- Running GHCi's internal expression is incompatible with -XSafe.
+ -- We temporarily disable any Safe Haskell settings while running
+ -- GHCi internal expressions. (see #12509)
+ safeHaskell = Sf_None
+ }
+ -- RebindableSyntax can wreak havoc with GHCi in several ways
+ -- (see #13385 and #14342 for examples), so we temporarily
+ -- disable it too.
`xopt_unset` LangExt.RebindableSyntax
-- We heavily depend on -fimplicit-import-qualified to compile expr
-- with fully qualified names without imports.
diff --git a/libraries/ghc-compact/tests/compact_serialize.stderr b/testsuite/tests/safeHaskell/ghci/T12509.script
similarity index 100%
copy from libraries/ghc-compact/tests/compact_serialize.stderr
copy to testsuite/tests/safeHaskell/ghci/T12509.script
diff --git a/testsuite/tests/safeHaskell/ghci/all.T b/testsuite/tests/safeHaskell/ghci/all.T
index 787cb7e..040cc28 100644
--- a/testsuite/tests/safeHaskell/ghci/all.T
+++ b/testsuite/tests/safeHaskell/ghci/all.T
@@ -18,4 +18,5 @@ test('p16', normal, ghci_script, ['p16.script'])
test('p17', normalise_version("bytestring"), ghci_script, ['p17.script'])
# 7172
test('p18', normalise_version("bytestring"), ghci_script, ['p18.script'])
+test('T12509', [extra_hc_opts('-XSafe')], ghci_script, ['T12509.script'])
More information about the ghc-commits
mailing list