fix(elaborator): max constraints

elaborator was not handling max constraints where one of the arguments was a Bool. Example:
      ctx |- max(Bool, Type) == ?M

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-10-24 19:27:53 -07:00
parent 46b9b2114a
commit 83907d7c73

View file

@ -1188,8 +1188,8 @@ class elaborator::imp {
bool process_max(unification_constraint const & c) { bool process_max(unification_constraint const & c) {
expr const & lhs1 = max_lhs1(c); expr lhs1 = max_lhs1(c);
expr const & lhs2 = max_lhs2(c); expr lhs2 = max_lhs2(c);
expr const & rhs = max_rhs(c); expr const & rhs = max_rhs(c);
buffer<justification> jsts; buffer<justification> jsts;
bool modified = false; bool modified = false;
@ -1230,6 +1230,10 @@ class elaborator::imp {
push_front(mk_max_constraint(get_context(c), new_lhs1, new_lhs2, new_rhs, new_jst)); push_front(mk_max_constraint(get_context(c), new_lhs1, new_lhs2, new_rhs, new_jst));
return true; return true;
} }
if (lhs1 == Bool)
lhs1 = Type();
if (lhs2 == Bool)
lhs2 = Type();
if (is_type(lhs1) && is_type(lhs2)) { if (is_type(lhs1) && is_type(lhs2)) {
justification new_jst(new normalize_justification(c)); justification new_jst(new normalize_justification(c));
expr new_lhs = mk_type(max(ty_level(lhs1), ty_level(lhs2))); expr new_lhs = mk_type(max(ty_level(lhs1), ty_level(lhs2)));