diff options
-rw-r--r-- | ghc/GHCi/UI/Monad.hs | 13 | ||||
-rw-r--r-- | testsuite/tests/safeHaskell/ghci/T12509.script | 0 | ||||
-rw-r--r-- | 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 8f60dfbb7e..dddbe824d6 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/testsuite/tests/safeHaskell/ghci/T12509.script b/testsuite/tests/safeHaskell/ghci/T12509.script new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testsuite/tests/safeHaskell/ghci/T12509.script diff --git a/testsuite/tests/safeHaskell/ghci/all.T b/testsuite/tests/safeHaskell/ghci/all.T index 787cb7e6b7..040cc288f9 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']) |