From 21f17d06aa5c33e639f1b0d37b4bf888b494c441 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones <simonpj@microsoft.com> Date: Tue, 13 May 2014 13:17:19 +0100 Subject: [PATCH] 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. --- 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 195bc4cbf2b..a8f9a2ee599 100644 --- a/compiler/types/Coercion.lhs +++ b/compiler/types/Coercion.lhs @@ -948,7 +948,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:_) [] = [downgradeRole r1 r2 co2] -- GitLab