[commit: ghc] ghc-7.8: Fix invariant in mkAppCoFlexible (0bbcdc8)

git at git.haskell.org git at git.haskell.org
Wed Jul 2 17:39:36 UTC 2014


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

On branch  : ghc-7.8
Link       : http://ghc.haskell.org/trac/ghc/changeset/0bbcdc88ca8596e1abd1ecfea1ad0835d2b99258/ghc

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

commit 0bbcdc88ca8596e1abd1ecfea1ad0835d2b99258
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue May 13 13:17:19 2014 +0100

    Fix invariant in mkAppCoFlexible
    
    mkAppCoFlexible was breaking the invariant that the head of a TyConAppCo cannot
    be a type synonym.  This small patch fixes it.
    
    (cherry picked from commit 21f17d06aa5c33e639f1b0d37b4bf888b494c441)


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

0bbcdc88ca8596e1abd1ecfea1ad0835d2b99258
 compiler/types/Coercion.lhs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/compiler/types/Coercion.lhs b/compiler/types/Coercion.lhs
index af2b2fa..d9e0740 100644
--- a/compiler/types/Coercion.lhs
+++ b/compiler/types/Coercion.lhs
@@ -899,7 +899,9 @@ mkAppCo co1 co2 = mkAppCoFlexible co1 Nominal co2
 mkAppCoFlexible :: Coercion -> Role -> Coercion -> Coercion
 mkAppCoFlexible (Refl r ty1) _ (Refl _ ty2)
   = Refl r (mkAppTy ty1 ty2)
-mkAppCoFlexible (Refl r (TyConApp tc tys)) r2 co2
+mkAppCoFlexible (Refl r ty1) r2 co2
+  | Just (tc, tys) <- splitTyConApp_maybe ty1
+    -- Expand type synonyms; a TyConAppCo can't have a type synonym (Trac #9102)
   = TyConAppCo r tc (zip_roles (tyConRolesX r tc) tys)
   where
     zip_roles (r1:_)  []        = [maybeSubCo2 r1 r2 co2]



More information about the ghc-commits mailing list