From 911a3e09ad48ff8dac5ee1399fe9294edf58d30c Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Wed, 10 Sep 2008 08:23:13 +0000 Subject: [PATCH] Fix Trac #2573; and explanatory comment --- compiler/typecheck/TcMType.lhs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcMType.lhs b/compiler/typecheck/TcMType.lhs index 1addfe4..02de940 100644 --- a/compiler/typecheck/TcMType.lhs +++ b/compiler/typecheck/TcMType.lhs @@ -524,6 +524,7 @@ writeMetaTyVar tyvar ty -- TOM: It should also work for coercions -- ASSERT2( k2 `isSubKind` k1, (ppr tyvar <+> ppr k1) $$ (ppr ty <+> ppr k2) ) do { ASSERTM2( do { details <- readMetaTyVar tyvar; return (isFlexi details) }, ppr tyvar ) + ; traceTc (text "writeMetaTyVar" <+> ppr tyvar <+> text ":=" <+> ppr ty) ; writeMutVar (metaTvRef tyvar) (Indirect ty) } where _k1 = tyVarKind tyvar @@ -997,18 +998,22 @@ checkValidType ctxt ty = do | otherwise = Rank n rank = case ctxt of - GenPatCtxt -> MustBeMonoType DefaultDeclCtxt-> MustBeMonoType ResSigCtxt -> MustBeMonoType LamPatSigCtxt -> gen_rank 0 BindPatSigCtxt -> gen_rank 0 TySynCtxt _ -> gen_rank 0 + GenPatCtxt -> gen_rank 1 + -- This one is a bit of a hack + -- See the forall-wrapping in TcClassDcl.mkGenericInstance + ExprSigCtxt -> gen_rank 1 FunSigCtxt _ -> gen_rank 1 ConArgCtxt _ | polycomp -> gen_rank 2 -- We are given the type of the entire -- constructor, hence rank 1 | otherwise -> gen_rank 1 + ForSigCtxt _ -> gen_rank 1 SpecInstCtxt -> gen_rank 1 -- 1.7.10.4