Commit 7cdcd3e1 authored by Roland Senn's avatar Roland Senn Committed by Marge Bot

Fix #12509: ghci -XSafe fails in an inscrutable way

parent b1e569a5
......@@ -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.
......
......@@ -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'])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment