summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/Opt
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-06-18 09:38:00 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2020-06-18 22:39:53 +0100
commitc07cbba91a586bbaf08d3b60dbc2dc13f1b0421e (patch)
treea1b4d2c7dfb7e9e1ba881a1c99fb296e9c127d60 /compiler/GHC/Core/Opt
parentfa4281d672e462b8421098b3506bd3c4c6a1f819 (diff)
downloadhaskell-wip/T18347.tar.gz
Fix a buglet in Simplify.simplCastwip/T18347
This bug, revealed by #18347, is just a missing update to sc_hole_ty in simplCast. I'd missed a code path when I made the recentchanges in commit 6d49d5be904c0c01788fa7aae1b112d5b4dfaf1c Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Thu May 21 12:53:35 2020 +0100 Implement cast worker/wrapper properly The fix is very easy. Two other minor changes * Tidy up in SimpleOpt.simple_opt_expr. In fact I think this is an outright bug, introduced in the fix to #18112: we were simplifying the same coercion twice *with the same substitution*, which is just wrong. It'd be a hard bug to trigger, so I just fixed it; less code too. * Better debug printing of ApplyToVal
Diffstat (limited to 'compiler/GHC/Core/Opt')
-rw-r--r--compiler/GHC/Core/Opt/Simplify.hs3
-rw-r--r--compiler/GHC/Core/Opt/Simplify/Utils.hs7
2 files changed, 6 insertions, 4 deletions
diff --git a/compiler/GHC/Core/Opt/Simplify.hs b/compiler/GHC/Core/Opt/Simplify.hs
index 81cf962d91..dba4362a81 100644
--- a/compiler/GHC/Core/Opt/Simplify.hs
+++ b/compiler/GHC/Core/Opt/Simplify.hs
@@ -1456,7 +1456,8 @@ simplCast env body co0 cont0
= {-#SCC "addCoerce-pushCoValArg" #-}
do { tail' <- addCoerceM m_co2 tail
; if isReflCo co1
- then return (cont { sc_cont = tail' })
+ then return (cont { sc_cont = tail'
+ , sc_hole_ty = coercionLKind co })
-- Avoid simplifying if possible;
-- See Note [Avoiding exponential behaviour]
else do
diff --git a/compiler/GHC/Core/Opt/Simplify/Utils.hs b/compiler/GHC/Core/Opt/Simplify/Utils.hs
index 5f2db4508d..eca8f0a474 100644
--- a/compiler/GHC/Core/Opt/Simplify/Utils.hs
+++ b/compiler/GHC/Core/Opt/Simplify/Utils.hs
@@ -221,9 +221,10 @@ instance Outputable SimplCont where
ppr (TickIt t cont) = (text "TickIt" <+> ppr t) $$ ppr cont
ppr (ApplyToTy { sc_arg_ty = ty, sc_cont = cont })
= (text "ApplyToTy" <+> pprParendType ty) $$ ppr cont
- ppr (ApplyToVal { sc_arg = arg, sc_dup = dup, sc_cont = cont })
- = (text "ApplyToVal" <+> ppr dup <+> pprParendExpr arg)
- $$ ppr cont
+ ppr (ApplyToVal { sc_arg = arg, sc_dup = dup, sc_cont = cont, sc_hole_ty = hole_ty })
+ = (hang (text "ApplyToVal" <+> ppr dup <+> text "hole" <+> ppr hole_ty)
+ 2 (pprParendExpr arg))
+ $$ ppr cont
ppr (StrictBind { sc_bndr = b, sc_cont = cont })
= (text "StrictBind" <+> ppr b) $$ ppr cont
ppr (StrictArg { sc_fun = ai, sc_cont = cont })