X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Ftypecheck%2FTcExpr.lhs;h=c5d9e36c24012b900af6bd1f236a24f98468037e;hb=ca5a4a480d10d61e5b7a52eb4d556e8b8c33e69d;hp=6b2bec7a860b4a93e7221ef31c65926b9b2ed006;hpb=a77abe6a30ea2763cfa1c0ca83cdce9b7200ced2;p=ghc-hetmet.git diff --git a/ghc/compiler/typecheck/TcExpr.lhs b/ghc/compiler/typecheck/TcExpr.lhs index 6b2bec7..c5d9e36 100644 --- a/ghc/compiler/typecheck/TcExpr.lhs +++ b/ghc/compiler/typecheck/TcExpr.lhs @@ -24,7 +24,7 @@ import TcHsSyn ( TcExpr(..), TcQual(..), TcStmt(..), mkHsTyApp ) -import TcMonad +import TcMonad hiding ( rnMtoTcM ) import Inst ( Inst, InstOrigin(..), OverloadedLit(..), LIE(..), emptyLIE, plusLIE, plusLIEs, newOverloadedLit, newMethod, newMethodWithGivenTy, newDicts ) @@ -361,7 +361,7 @@ tcExpr (ExplicitTuple exprs) tcExpr (RecordCon (HsVar con) rbinds) = tcId con `thenNF_Tc` \ (con_expr, con_lie, con_tau) -> let - (_, record_ty) = splitFunTy con_tau + (_, record_ty) = splitFunTy con_tau in -- Con is syntactically constrained to be a data constructor ASSERT( maybeToBool (maybeAppDataTyCon record_ty ) ) @@ -708,6 +708,12 @@ tcListComp expr (qual@(GeneratorQual pat rhs) : quals) tcAddErrCtxt (qualCtxt qual) ( tcPat pat `thenTc` \ (pat', lie_pat, pat_ty) -> tcExpr rhs `thenTc` \ (rhs', lie_rhs, rhs_ty) -> + -- NB: the environment has been extended with the new binders + -- which the rhs can't "see", but the renamer should have made + -- sure that everything is distinct by now, so there's no problem. + -- Putting the tcExpr before the newMonoIds messes up the nesting + -- of error contexts, so I didn't bother + unifyTauTy (mkListTy pat_ty) rhs_ty `thenTc_` returnTc (GeneratorQual pat' rhs', lie_pat `plusLIE` lie_rhs)