virtual expr check_type(expr const & m, abstract_type_context & ctx, bool infer_only) const { check_macro(m); expr given_type = macro_arg(m, 0); if (!infer_only) { ctx.check(given_type, infer_only); expr inferred_type = ctx.check(macro_arg(m, 1), infer_only); if (!ctx.is_def_eq(inferred_type, given_type)) { throw_kernel_exception(ctx.env(), m, [=](formatter const & fmt) { return format("type mismatch at term") + pp_type_mismatch(fmt, macro_arg(m, 1), inferred_type, given_type); }); } } return given_type; }
virtual pair<expr, constraint_seq> check_type(expr const & m, extension_context & ctx, bool infer_only) const { constraint_seq cseq; check_macro(m); expr given_type = macro_arg(m, 0); if (!infer_only) { cseq += ctx.check_type(given_type, infer_only).second; auto p = ctx.check_type(macro_arg(m, 1), infer_only); expr inferred_type = p.first; cseq += p.second; justification jst = mk_type_mismatch_jst(macro_arg(m, 1), inferred_type, given_type, m); as_delayed_justification djst(jst); if (!ctx.is_def_eq(inferred_type, given_type, djst, cseq)) { throw_kernel_exception(ctx.env(), m, [=](formatter const & fmt) { return pp_type_mismatch(fmt, macro_arg(m, 1), inferred_type, given_type); }); } } return mk_pair(given_type, cseq); }