diff options
| author | Simon Peyton Jones <simonpj@microsoft.com> | 2012-09-09 07:07:39 +0100 |
|---|---|---|
| committer | Simon Peyton Jones <simonpj@microsoft.com> | 2012-09-09 07:07:39 +0100 |
| commit | c32bb5d0c09a7e55197191f152c6875b398717cf (patch) | |
| tree | d0be7082ae3546456e137d0a5dfe3e92d4edd78a | |
| parent | d8b48bab54316cf2c36c50f7f0a68087c01dee20 (diff) | |
| download | haskell-c32bb5d0c09a7e55197191f152c6875b398717cf.tar.gz | |
Remember to zonk the skolems of an implication
Their kinds may contain kind unification variables!
This patch fixes Trac #7230.
| -rw-r--r-- | compiler/typecheck/TcMType.lhs | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/compiler/typecheck/TcMType.lhs b/compiler/typecheck/TcMType.lhs index a80c65d1d0..a212f2506d 100644 --- a/compiler/typecheck/TcMType.lhs +++ b/compiler/typecheck/TcMType.lhs @@ -593,14 +593,17 @@ skolemiseSigTv tv \begin{code} zonkImplication :: Implication -> TcM Implication -zonkImplication implic@(Implic { ic_given = given +zonkImplication implic@(Implic { ic_skols = skols + , ic_given = given , ic_wanted = wanted , ic_loc = loc }) - = do { -- No need to zonk the skolems + = do { skols' <- mapM zonkTcTyVarBndr skols -- Need to zonk their kinds! + -- as Trac #7230 showed ; given' <- mapM zonkEvVar given ; loc' <- zonkGivenLoc loc ; wanted' <- zonkWC wanted - ; return (implic { ic_given = given' + ; return (implic { ic_skols = skols' + , ic_given = given' , ic_wanted = wanted' , ic_loc = loc' }) } @@ -765,10 +768,18 @@ zonkTcType ty | otherwise = TyVarTy <$> updateTyVarKindM go tyvar -- Ordinary (non Tc) tyvars occur inside quantified types - go (ForAllTy tyvar ty) = ASSERT2( isImmutableTyVar tyvar, ppr tyvar ) do - ty' <- go ty - tyvar' <- updateTyVarKindM go tyvar - return (ForAllTy tyvar' ty') + go (ForAllTy tv ty) = do { tv' <- zonkTcTyVarBndr tv + ; ty' <- go ty + ; return (ForAllTy tv' ty') } + +zonkTcTyVarBndr :: TcTyVar -> TcM TcTyVar +-- A tyvar binder is never a unification variable (MetaTv), +-- rather it is always a skolems. BUT it may have a kind +-- that has not yet been zonked, and may include kind +-- unification variables. +zonkTcTyVarBndr tyvar + = ASSERT2( isImmutableTyVar tyvar, ppr tyvar ) do + updateTyVarKindM zonkTcType tyvar zonkTcTyVar :: TcTyVar -> TcM TcType -- Simply look through all Flexis |
