[commit: ghc] master: Fix a substitution bug in cseCase (e55986a)

git at git.haskell.org git at git.haskell.org
Fri Feb 17 14:00:48 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/e55986a9810129d47a59c0bd4fcdc96f32108041/ghc

>---------------------------------------------------------------

commit e55986a9810129d47a59c0bd4fcdc96f32108041
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Feb 17 12:47:39 2017 +0000

    Fix a substitution bug in cseCase
    
    There was a missing substTy in cseCase!  Wow.  I'm surprised
    it has not caused problems.  Anyway, easily fixed.


>---------------------------------------------------------------

e55986a9810129d47a59c0bd4fcdc96f32108041
 compiler/simplCore/CSE.hs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs
index 21dbd07..80013a3 100644
--- a/compiler/simplCore/CSE.hs
+++ b/compiler/simplCore/CSE.hs
@@ -392,8 +392,9 @@ cseExpr env (Case e bndr ty alts) = cseCase env e bndr ty alts
 
 cseCase :: CSEnv -> InExpr -> InId -> InType -> [InAlt] -> OutExpr
 cseCase env scrut bndr ty alts
-  = Case scrut1 bndr3 ty (map cse_alt alts)
+  = Case scrut1 bndr3 ty' (map cse_alt alts)
   where
+    ty' = substTy (csEnvSubst env) ty
     scrut1 = tryForCSE False env scrut
 
     bndr1 = zapIdOccInfo bndr



More information about the ghc-commits mailing list