tc_cmd env in_cmd@(HsCase scrut matches) (stk, res_ty)
= addErrCtxt (cmdCtxt in_cmd) $ do
- (scrut', scrut_ty) <- addErrCtxt (caseScrutCtxt scrut) $
- tcInferRho scrut
+ (scrut', scrut_ty) <- tcInferRho scrut
matches' <- tcMatchesCase match_ctxt scrut_ty matches res_ty
return (HsCase scrut' matches')
where
tc_cmd env cmd@(HsLam (MatchGroup [L mtch_loc (match@(Match pats _maybe_rhs_sig grhss))] _))
(cmd_stk, res_ty)
- = addErrCtxt (matchCtxt match_ctxt match) $
+ = addErrCtxt (pprMatchInCtxt match_ctxt match) $
do { -- Check the cmd stack is big enough
; checkTc (lengthAtLeast cmd_stk n_pats)
cmdCtxt :: HsExpr Name -> SDoc
cmdCtxt cmd = ptext (sLit "In the command:") <+> ppr cmd
-caseScrutCtxt :: LHsExpr Name -> SDoc
-caseScrutCtxt cmd
- = hang (ptext (sLit "In the scrutinee of a case command:")) 4 (ppr cmd)
-
nonEmptyCmdStkErr :: HsExpr Name -> SDoc
nonEmptyCmdStkErr cmd
= hang (ptext (sLit "Non-empty command stack at command:"))