fix(frontends/lean/pp): make pp_have more robust

We should not assume the argument of a have_annotation is a lambda.
This commit is contained in:
Leonardo de Moura 2015-06-10 16:19:27 -07:00
parent 01127061f5
commit f64784378a

View file

@ -730,7 +730,9 @@ auto pretty_fn::pp_pi(expr const & e) -> result {
}
}
static bool is_have(expr const & e) { return is_app(e) && is_have_annotation(app_fn(e)); }
static bool is_have(expr const & e) {
return is_app(e) && is_have_annotation(app_fn(e)) && is_binding(get_annotation_arg(app_fn(e)));
}
static bool is_show(expr const & e) {
return is_show_annotation(e) && is_app(get_annotation_arg(e)) &&
is_lambda(app_fn(get_annotation_arg(e)));