X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Ftypecheck%2FTcClassDcl.lhs;h=a3fd3b4fc3c9d078c304bb1902a9dba1051e381c;hb=5e3f005d3012472e422d4ffd7dca5c21a80fca80;hp=cdd2c7ec28f3d58dd6d49769b6e853c20452e7a7;hpb=f5a6b456f08ab320ef0d07a08d90a63557c39364;p=ghc-hetmet.git diff --git a/ghc/compiler/typecheck/TcClassDcl.lhs b/ghc/compiler/typecheck/TcClassDcl.lhs index cdd2c7e..a3fd3b4 100644 --- a/ghc/compiler/typecheck/TcClassDcl.lhs +++ b/ghc/compiler/typecheck/TcClassDcl.lhs @@ -25,16 +25,17 @@ import TcHsSyn ( TcMonoBinds ) import Inst ( Inst, InstOrigin(..), LIE, emptyLIE, plusLIE, plusLIEs, instToId, newDicts, newMethod ) -import TcEnv ( RecTcEnv, TyThingDetails(..), tcAddImportedIdInfo, +import TcEnv ( RecTcEnv, TyThingDetails(..), tcLookupClass, tcExtendTyVarEnvForMeths, tcExtendGlobalTyVars, tcExtendLocalValEnv, tcExtendTyVarEnv ) import TcBinds ( tcBindWithSigs, tcSpecSigs ) -import TcMonoType ( tcHsType, tcHsTheta, checkSigTyVars, sigCtxt, mkTcSig ) +import TcMonoType ( tcHsType, tcHsTheta, mkTcSig ) import TcSimplify ( tcSimplifyCheck, bindInstsOfLocalFuns ) +import TcUnify ( checkSigTyVars, sigCtxt ) import TcMType ( tcInstSigTyVars, checkValidTheta, checkValidType, SourceTyCtxt(..), UserTypeCtxt(..) ) import TcType ( Type, TyVarDetails(..), TcType, TcThetaType, TcTyVar, - mkSigmaTy, mkTyVarTys, mkPredTys, mkClassPred, + mkTyVarTys, mkPredTys, mkClassPred, tcIsTyVarTy, tcSplitTyConApp_maybe, tcSplitSigmaTy ) import TcMonad @@ -495,7 +496,6 @@ tcMethodBind clas origin inst_tyvars inst_tys inst_theta let meth_id = instToId meth meth_name = idName meth_id - sig_msg = ptext SLIT("When checking the expected type for class method") <+> ppr sel_id meth_prags = find_prags (idName sel_id) meth_name prags in mkTcSig meth_id loc `thenNF_Tc` \ sig_info -> @@ -532,7 +532,9 @@ tcMethodBind clas origin inst_tyvars inst_tys inst_theta -- We do this for each method independently to localise error messages -- ...and this is why the call to tcExtendGlobalTyVars must be here -- rather than in the caller - tcAddErrCtxtM (sigCtxt sig_msg inst_tyvars inst_theta (idType meth_id)) $ + tcAddErrCtxt (ptext SLIT("When checking the type of class method") + <+> quotes (ppr sel_id)) $ + tcAddErrCtxtM (sigCtxt inst_tyvars inst_theta (idType meth_id)) $ checkSigTyVars inst_tyvars emptyVarSet `thenTc_` returnTc (binds `AndMonoBinds` prag_binds1 `AndMonoBinds` prag_binds2,