summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarter Tazio Schonwald <carter.schonwald@gmail.com>2020-01-01 02:00:32 -0500
committerCarter Tazio Schonwald <carter.schonwald@gmail.com>2020-01-04 14:55:50 -0500
commit784d44a01e8293bf07289ad94d47fc54f2a4b2dc (patch)
tree902d9a9a959bd85dc83490dec276a4788a53b1dd
parent407f436d07a8f0263dd7286e6fdb95f49415fb4f (diff)
downloadhaskell-784d44a01e8293bf07289ad94d47fc54f2a4b2dc.tar.gz
if the coercion is a Refl or MRefl, lets just keep it.
-rw-r--r--compiler/simplCore/CoreEraseCoercionProofs.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/simplCore/CoreEraseCoercionProofs.hs b/compiler/simplCore/CoreEraseCoercionProofs.hs
index baa0695cb7..d2417416ac 100644
--- a/compiler/simplCore/CoreEraseCoercionProofs.hs
+++ b/compiler/simplCore/CoreEraseCoercionProofs.hs
@@ -8,7 +8,7 @@ import HscTypes ( ModGuts(..) )
import Coercion
import CoreMonad ( CoreM )
import DynFlags
-import TyCoRep (Coercion(ErasedCoercion))
+import TyCoRep (Coercion(..))
{-
Top-level interface function, @eraseCoercionProgram@.
@@ -38,12 +38,18 @@ coreExprEraseProof (Case scrut v ty alts )=
Case (coreExprEraseProof scrut) v ty (map eraseAltPfs alts)
--- TODO : add mrefl and refl cases,
--- that should suffice to prevent regresions vs current ghc
-coreExprEraseProof (Cast e co ) = Cast (coreExprEraseProof e) (ErasedCoercion role lty rty )
+coreExprEraseProof (Cast e co ) =case co of
+ (Refl _t) -> Cast e co
+ (GRefl _r _t MRefl) -> Cast e co
+ (_) -> Coercion (ErasedCoercion role lty rty Cast (coreExprEraseProof e) (ErasedCoercion role lty rty )
where
(Pair lty rty,role) = coercionKindRole co
coreExprEraseProof (Tick tick e)= Tick tick (coreExprEraseProof e)
coreExprEraseProof (Type t) = Type t
-coreExprEraseProof (Coercion co )= Coercion (ErasedCoercion role lty rty )
+coreExprEraseProof (Coercion co )= case co of
+ (Refl t) -> Coercion co
+ (GRefl r t MRefl) -> Coercion co
+ (_) -> Coercion (ErasedCoercion role lty rty )
where
(Pair lty rty,role) = coercionKindRole co
eraseAltPfs :: CoreAlt -> CoreAlt