X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcPat.lhs;h=2a2409e7ba92446c3ca64c42553cff1b350fbcd5;hb=1add6282808b5ae98e72ef7034634036c9b91b04;hp=6a30754dd12a1a23365173a1c8dcd7aefd3aec97;hpb=9e8ed75238e8b9456de540b07db5adf8ce7fb116;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcPat.lhs b/compiler/typecheck/TcPat.lhs index 6a30754..2a2409e 100644 --- a/compiler/typecheck/TcPat.lhs +++ b/compiler/typecheck/TcPat.lhs @@ -617,10 +617,6 @@ tcConPat pstate con_span data_con tycon pat_ty arg_pats thing_inside where uwScrut = unwrapFamInstScrutinee tycon ctxt_res_tys res_pat - ; traceTc $ case sym_coi of - IdCo -> text "sym_coi:IdCo" - ACo co -> text "sym_coi: ACoI" <+> ppr co - -- Add the stupid theta ; addDataConStupidTheta data_con ctxt_res_tys @@ -655,7 +651,7 @@ tcConPat pstate con_span data_con tycon pat_ty arg_pats thing_inside -- ex_tvs was non-null. -- ; unless (null theta') $ -- FIXME: AT THE MOMENT WE CHEAT! We only perform the rigidity test - -- if we explicit or implicit (by a GADT def) have equality + -- if we explicitly or implicitly (by a GADT def) have equality -- constraints. ; let eq_preds = [mkEqPred (mkTyVarTy tv, ty) | (tv, ty) <- eq_spec] theta' = substTheta tenv (eq_preds ++ full_theta) @@ -665,8 +661,8 @@ tcConPat pstate con_span data_con tycon pat_ty arg_pats thing_inside pstate' | no_equalities = pstate | otherwise = pstate { pat_eqs = True } - ; unless no_equalities (checkTc (isRigidTy pat_ty) - (nonRigidMatch data_con)) + ; unless no_equalities $ + checkTc (isRigidTy pat_ty) (nonRigidMatch data_con) ; ((arg_pats', inner_tvs, res), lie_req) <- getLIE $ tcConArgs data_con arg_tys' arg_pats pstate' thing_inside @@ -719,7 +715,6 @@ tcConPat pstate con_span data_con tycon pat_ty arg_pats thing_inside | otherwise = pat - tcConArgs :: DataCon -> [TcSigmaType] -> Checker (HsConPatDetails Name) (HsConPatDetails Id) @@ -799,7 +794,9 @@ addDataConStupidTheta data_con inst_tys -- The origin should always report "occurrence of C" -- even when C occurs in a pattern stupid_theta = dataConStupidTheta data_con - tenv = zipTopTvSubst (dataConUnivTyVars data_con) inst_tys + tenv = mkTopTvSubst (dataConUnivTyVars data_con `zip` inst_tys) + -- NB: inst_tys can be longer than the univ tyvars + -- because the constructor might have existentials inst_theta = substTheta tenv stupid_theta \end{code}