From f2b02ce821f793bd1ccc23f2bcbef8efc82dd38e Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Mon, 2 Apr 2007 07:38:35 +0000 Subject: [PATCH] Make type-tidying work for coercion variables When tidying a TyVar binder, we must tidy its kind if it's a coercion variable! I had forgotten to do this, which is a serious bug. As a result some more complicated programs were getting a Lint error when reading in interface files. Score one for Core Lint! --- compiler/types/Type.lhs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/compiler/types/Type.lhs b/compiler/types/Type.lhs index fd81795..fe70716 100644 --- a/compiler/types/Type.lhs +++ b/compiler/types/Type.lhs @@ -733,13 +733,17 @@ It doesn't change the uniques at all, just the print names. \begin{code} tidyTyVarBndr :: TidyEnv -> TyVar -> (TidyEnv, TyVar) -tidyTyVarBndr (tidy_env, subst) tyvar +tidyTyVarBndr env@(tidy_env, subst) tyvar = case tidyOccName tidy_env (getOccName name) of - (tidy', occ') -> ((tidy', subst'), tyvar') - where - subst' = extendVarEnv subst tyvar tyvar' - tyvar' = setTyVarName tyvar name' - name' = tidyNameOcc name occ' + (tidy', occ') -> ((tidy', subst'), tyvar'') + where + subst' = extendVarEnv subst tyvar tyvar'' + tyvar' = setTyVarName tyvar name' + name' = tidyNameOcc name occ' + -- Don't forget to tidy the kind for coercions! + tyvar'' | isCoVar tyvar = setTyVarKind tyvar' kind' + | otherwise = tyvar' + kind' = tidyType env (tyVarKind tyvar) where name = tyVarName tyvar -- 1.7.10.4