Commit f2b02ce8 authored by simonpj@microsoft.com's avatar simonpj@microsoft.com
Browse files

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!
parent beab356b
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment