From edaedc5b6129cb80f875f5eaa39818643a2cff35 Mon Sep 17 00:00:00 2001 From: simonpj Date: Mon, 16 May 2005 12:38:38 +0000 Subject: [PATCH] [project @ 2005-05-16 12:38:38 by simonpj] Newtype representation Merge to STABLE This commit fixes a long-standing bug (simple clerical error) in mkNewTyConRep, which for some reason had gone un-discovered for years. tc183 tests it. --- ghc/compiler/iface/BuildTyCl.lhs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ghc/compiler/iface/BuildTyCl.lhs b/ghc/compiler/iface/BuildTyCl.lhs index 6636d77..44a8a76 100644 --- a/ghc/compiler/iface/BuildTyCl.lhs +++ b/ghc/compiler/iface/BuildTyCl.lhs @@ -80,6 +80,7 @@ mkNewTyConRhs tycon con mkNewTyConRep :: TyCon -- The original type constructor -> Type -- Chosen representation type -- (guaranteed not to be another newtype) + -- Free vars of rep = tyConTyVars tc -- Find the representation type for this newtype TyCon -- Remember that the representation type is the *ultimate* representation @@ -103,11 +104,12 @@ mkNewTyConRep tc | tc `elem` tcs = unitTy | otherwise = case splitTyConApp_maybe rhs_ty of - Just (tc', tys) | isNewTyCon tc' - -> substTyWith tc_tvs tys (go (tc:tcs) tc') + Just (tc1, tys) | isNewTyCon tc1 + -> ASSERT( length (tyConTyVars tc1) == length tys ) + substTyWith (tyConTyVars tc1) tys (go (tc:tcs) tc1) other -> rhs_ty where - (tc_tvs, rhs_ty) = newTyConRhs tc + (_tc_tvs, rhs_ty) = newTyConRhs tc ------------------------------------------------------ -- 1.7.10.4