refactor(kernel/error_msgs): move pp_type_mismatch to error_msgs module

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-07-19 21:15:32 +01:00
parent 55db3aaaa1
commit e39a6e732a
3 changed files with 9 additions and 8 deletions

View file

@ -1153,14 +1153,6 @@ public:
return apply(s, r);
}
static format pp_type_mismatch(formatter const & fmt, expr const & expected_type, expr const & given_type) {
format r("type mismatch, expected type");
r += ::lean::pp_indent_expr(fmt, expected_type);
r += compose(line(), format("given type:"));
r += ::lean::pp_indent_expr(fmt, given_type);
return r;
}
std::tuple<expr, expr, level_param_names> operator()(expr const & t, expr const & v, name const & n) {
lean_assert(!has_local(t)); lean_assert(!has_local(v));
expr r_t = ensure_type(visit(t));

View file

@ -40,6 +40,14 @@ format pp_def_type_mismatch(formatter const & fmt, name const & n, expr const &
return r;
}
format pp_type_mismatch(formatter const & fmt, expr const & expected_type, expr const & given_type) {
format r("type mismatch, expected type");
r += ::lean::pp_indent_expr(fmt, expected_type);
r += compose(line(), format("given type:"));
r += ::lean::pp_indent_expr(fmt, given_type);
return r;
}
format pp_decl_has_metavars(formatter const & fmt, name const & n, expr const & e, bool is_type) {
format r("failed to add declaration '");
r += format(n);

View file

@ -13,5 +13,6 @@ format pp_type_expected(formatter const & fmt, expr const & e);
format pp_function_expected(formatter const & fmt, expr const & e);
format pp_app_type_mismatch(formatter const & fmt, expr const & app, expr const & expected_type, expr const & given_type);
format pp_def_type_mismatch(formatter const & fmt, name const & n, expr const & expected_type, expr const & given_type);
format pp_type_mismatch(formatter const & fmt, expr const & expected_type, expr const & given_type);
format pp_decl_has_metavars(formatter const & fmt, name const & n, expr const & e, bool is_type);
}