fix(library/class): bug in whnf_pred predicate

This commit is contained in:
Leonardo de Moura 2016-11-05 11:44:05 -07:00
parent a551de8f36
commit 43aa6eb87f

View file

@ -186,7 +186,9 @@ environment add_instance_core(environment const & env, name const & n, unsigned
class_state S = class_ext::get_state(env);
type_context::tmp_locals locals(ctx);
while (true) {
type = ctx.whnf_pred(type, [&](expr const & e) { return !is_constant(e) || !S.m_instances.contains(const_name(e)); });
type = ctx.whnf_pred(type, [&](expr const & e) {
expr const & fn = get_app_fn(e);
return !is_constant(fn) || !S.m_instances.contains(const_name(fn)); });
if (!is_pi(type))
break;
expr x = locals.push_local_from_binding(type);