[commit: ghc] master: Fix associated type default instantiation check (#5481) (7ca27dc)
Max Bolingbroke
batterseapower at hotmail.com
Sun Sep 11 19:45:39 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/7ca27dce4943ae3b99dd97d1cb5d51863a9a8b02
>---------------------------------------------------------------
commit 7ca27dce4943ae3b99dd97d1cb5d51863a9a8b02
Author: Max Bolingbroke <batterseapower at hotmail.com>
Date: Sun Sep 11 17:09:31 2011 +0100
Fix associated type default instantiation check (#5481)
>---------------------------------------------------------------
compiler/typecheck/TcTyClsDecls.lhs | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/compiler/typecheck/TcTyClsDecls.lhs b/compiler/typecheck/TcTyClsDecls.lhs
index b8a376b..5614116 100644
--- a/compiler/typecheck/TcTyClsDecls.lhs
+++ b/compiler/typecheck/TcTyClsDecls.lhs
@@ -618,12 +618,12 @@ tcDefaultAssocDecl fam_tc clas_tvs (L loc decl)
-- See Note [Checking consistent instantiation]
-- We only want to check this on the *class* TyVars,
-- not the *family* TyVars (there may be more of these)
- ; zipWithM_ check_arg clas_tvs at_tys
+ ; zipWithM_ check_arg (tyConTyVars fam_tc) at_tys
; return (ATD at_tvs at_tys at_rhs) }
where
check_arg fam_tc_tv at_ty
- = checkTc (mkTyVarTy fam_tc_tv `eqType` at_ty)
+ = checkTc (not (fam_tc_tv `elem` clas_tvs) || mkTyVarTy fam_tc_tv `eqType` at_ty)
(wrongATArgErr at_ty (mkTyVarTy fam_tc_tv))
-------------------------
More information about the Cvs-ghc
mailing list