From: simonpj Date: Mon, 16 May 2005 12:38:38 +0000 (+0000) Subject: [project @ 2005-05-16 12:38:38 by simonpj] X-Git-Tag: Initial_conversion_from_CVS_complete~549 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=edaedc5b6129cb80f875f5eaa39818643a2cff35;p=ghc-hetmet.git [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. --- 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 ------------------------------------------------------