Commit 1f6d1422 authored by triple's avatar triple Committed by Ben Gamari
Browse files

ghci: fix trac issue #11481

Test Plan: validate

Reviewers: thomie, austin, bgamari

Reviewed By: bgamari

Differential Revision: https://phabricator.haskell.org/D1833

GHC Trac Issues: #11481
parent 448ea978
......@@ -28,7 +28,7 @@ module DynFlags (
ProfAuto(..),
glasgowExtsFlags,
dopt, dopt_set, dopt_unset,
gopt, gopt_set, gopt_unset,
gopt, gopt_set, gopt_unset, setGeneralFlag', unSetGeneralFlag',
wopt, wopt_set, wopt_unset,
xopt, xopt_set, xopt_unset,
lang_set,
......
......@@ -1460,17 +1460,14 @@ checkModule m = do
-- :load, :add, :reload
-- | Sets '-fdefer-type-errors' if 'defer' is true, executes 'load' and unsets
-- '-fdefer-type-errors' again if it has not been set before
-- '-fdefer-type-errors' again if it has not been set before.
deferredLoad :: Bool -> InputT GHCi SuccessFlag -> InputT GHCi ()
deferredLoad defer load = do
flags <- getDynFlags
deferredBefore <- return (gopt Opt_DeferTypeErrors flags)
when (defer) $ Monad.void $
GHC.setProgramDynFlags $ gopt_set flags Opt_DeferTypeErrors
originalFlags <- getDynFlags
when defer $ Monad.void $
GHC.setProgramDynFlags $ setGeneralFlag' Opt_DeferTypeErrors originalFlags
Monad.void $ load
flags <- getDynFlags
when (not deferredBefore) $ Monad.void $
GHC.setProgramDynFlags $ gopt_unset flags Opt_DeferTypeErrors
Monad.void $ GHC.setProgramDynFlags $ originalFlags
loadModule :: [(FilePath, Maybe Phase)] -> InputT GHCi SuccessFlag
loadModule fs = timeIt (const Nothing) (loadModule' fs)
......
......@@ -3,5 +3,8 @@ module Main where
a :: Int
a = 'p'
f :: Int
f = _
main :: IO ()
main = print "No errors!"
main = print f
Defer03.hs:4:5: warning:
Couldn't match expected type ‘Int’ with actual type ‘Char’
In the expression: 'p'
In an equation for ‘a’: a = 'p'
• Couldn't match expected type ‘Int’ with actual type ‘Char’
• In the expression: 'p'
In an equation for ‘a’: a = 'p'
Defer03.hs:7:5: warning:
• Found hole: _ :: Int
• In the expression: _
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
Defer03.hs:4:5: error:
Couldn't match expected type ‘Int’ with actual type ‘Char’
In the expression: 'p'
In an equation for ‘a’: a = 'p'
• Couldn't match expected type ‘Int’ with actual type ‘Char’
• In the expression: 'p'
In an equation for ‘a’: a = 'p'
Defer03.hs:7:5: error:
• Found hole: _ :: Int
• In the expression: _
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
Defer03.hs:4:5: warning:
Couldn't match expected type ‘Int’ with actual type ‘Char’
In the expression: 'p'
In an equation for ‘a’: a = 'p'
• Couldn't match expected type ‘Int’ with actual type ‘Char’
• In the expression: 'p'
In an equation for ‘a’: a = 'p'
Defer03.hs:7:5: warning:
• Found hole: _ :: Int
• In the expression: _
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
Defer03.hs:4:5: error:
Couldn't match expected type ‘Int’ with actual type ‘Char’
In the expression: 'p'
In an equation for ‘a’: a = 'p'
• Couldn't match expected type ‘Int’ with actual type ‘Char’
• In the expression: 'p'
In an equation for ‘a’: a = 'p'
Defer03.hs:7:5: error:
• Found hole: _ :: Int
• In the expression: _
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
Defer03.hs:4:5: warning:
Couldn't match expected type ‘Int’ with actual type ‘Char’
In the expression: 'p'
In an equation for ‘a’: a = 'p'
• Couldn't match expected type ‘Int’ with actual type ‘Char’
• In the expression: 'p'
In an equation for ‘a’: a = 'p'
Defer03.hs:7:5: warning:
• Found hole: _ :: Int
• In the expression: _
In an equation for ‘f’: f = _
• Relevant bindings include f :: Int (bound at Defer03.hs:7:1)
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