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:
parent
55db3aaaa1
commit
e39a6e732a
3 changed files with 9 additions and 8 deletions
|
@ -1153,14 +1153,6 @@ public:
|
||||||
return apply(s, r);
|
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) {
|
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));
|
lean_assert(!has_local(t)); lean_assert(!has_local(v));
|
||||||
expr r_t = ensure_type(visit(t));
|
expr r_t = ensure_type(visit(t));
|
||||||
|
|
|
@ -40,6 +40,14 @@ format pp_def_type_mismatch(formatter const & fmt, name const & n, expr const &
|
||||||
return r;
|
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 pp_decl_has_metavars(formatter const & fmt, name const & n, expr const & e, bool is_type) {
|
||||||
format r("failed to add declaration '");
|
format r("failed to add declaration '");
|
||||||
r += format(n);
|
r += format(n);
|
||||||
|
|
|
@ -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_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_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_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);
|
format pp_decl_has_metavars(formatter const & fmt, name const & n, expr const & e, bool is_type);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue