Commit 1f98e47d authored by Simon Peyton Jones's avatar Simon Peyton Jones Committed by Marge Bot

Use the right type in :force

A missing prime meant that we were considering the wrong
type in the GHCi debugger, when doing :force on multiple
arguments (issue #17431).

The fix is trivial.
parent 011f3121
......@@ -74,7 +74,8 @@ pprintClosureCommand bindThings force str = do
-- Do the obtainTerm--bindSuspensions-computeSubstitution dance
go :: GhcMonad m => TCvSubst -> Id -> m (TCvSubst, Term)
go subst id = do
let id' = id `setIdType` substTy subst (idType id)
let id_ty' = substTy subst (idType id)
id' = id `setIdType` id_ty'
term_ <- GHC.obtainTermFromId maxBound force id'
term <- tidyTermTyVars term_
term' <- if bindThings
......@@ -85,13 +86,14 @@ pprintClosureCommand bindThings force str = do
-- mapping the old tyvars to the reconstructed types.
let reconstructed_type = termType term
hsc_env <- getSession
case (improveRTTIType hsc_env (idType id) (reconstructed_type)) of
case (improveRTTIType hsc_env id_ty' reconstructed_type) of
Nothing -> return (subst, term')
Just subst' -> do { dflags <- GHC.getSessionDynFlags
; liftIO $
dumpIfSet_dyn dflags Opt_D_dump_rtti "RTTI"
(fsep $ [text "RTTI Improvement for", ppr id,
text "is the substitution:" , ppr subst'])
text "old substitution:" , ppr subst,
text "new substitution:" , ppr subst'])
; return (subst `unionTCvSubst` subst', term')}
tidyTermTyVars :: GhcMonad m => Term -> m Term
......
module T17431 (sort) where
sort :: Ord a => [a] -> [a]
sort [] = []
sort (x:xs) = insert x (sort xs)
insert :: Ord a => a -> [a] -> [a]
insert x [] = [x]
insert x (y:ys) | x < y = x:y:ys
| otherwise = y:(insert x ys)
:l T17431
:br 5
sort [3,2,1]
:force x xs _result
Breakpoint 0 activated at T17431.hs:5:15-32
Stopped in T17431.sort, T17431.hs:5:15-32
_result :: [a] = _
x :: a = _
xs :: [a] = [_,_]
*** Ignoring breakpoint
*** Ignoring breakpoint
*** Ignoring breakpoint
x = 3
xs = [2,1]
_result = [1,2,3]
......@@ -310,3 +310,4 @@ test('T16876', normal, ghci_script, ['T16876.script'])
test('T17345', normal, ghci_script, ['T17345.script'])
test('T17384', normal, ghci_script, ['T17384.script'])
test('T17403', normal, ghci_script, ['T17403.script'])
test('T17431', normal, ghci_script, ['T17431.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