summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorsimonpj <unknown>2002-09-02 16:38:24 +0000
committersimonpj <unknown>2002-09-02 16:38:24 +0000
commitd5254eea37cf82e8f215469e3186cec4069893e1 (patch)
tree0a86dc61db0b8cdf6954082e728ac4a094d6565c /ghc
parent210cba682cd91e166d902cef85003176caacf5d1 (diff)
downloadhaskell-d5254eea37cf82e8f215469e3186cec4069893e1.tar.gz
[project @ 2002-09-02 16:38:24 by simonpj]
Fix an obscure bug in an optimisation for 'coerce' which wasn't taking account of the possiblity of type arguments. MERGE TO STABLE
Diffstat (limited to 'ghc')
-rw-r--r--ghc/compiler/simplCore/Simplify.lhs6
1 files changed, 4 insertions, 2 deletions
diff --git a/ghc/compiler/simplCore/Simplify.lhs b/ghc/compiler/simplCore/Simplify.lhs
index 0a30390548..303fd65e00 100644
--- a/ghc/compiler/simplCore/Simplify.lhs
+++ b/ghc/compiler/simplCore/Simplify.lhs
@@ -795,12 +795,14 @@ simplNote env (Coerce to from) body cont
-- the inner one is redundant
addCoerce t1t2 s1s2 (ApplyTo dup arg arg_se cont)
- | Just (s1, s2) <- splitFunTy_maybe s1s2
+ | not (isTypeArg arg), -- This whole case only works for value args
+ -- Could upgrade to have equiv thing for type apps too
+ Just (s1, s2) <- splitFunTy_maybe s1s2
-- (coerce (T1->T2) (S1->S2) F) E
-- ===>
-- coerce T2 S2 (F (coerce S1 T1 E))
--
- -- t1t2 must be a function type, T1->T2
+ -- t1t2 must be a function type, T1->T2, because it's applied to something
-- but s1s2 might conceivably not be
--
-- When we build the ApplyTo we can't mix the out-types