fix(library/unifier): missing justification when updating choice constraints
The bug was not producing incorrect results, but really bad error messages. See: empty.lean.expected.out
This commit is contained in:
parent
a9741c5c30
commit
60d8369688
4 changed files with 22 additions and 14 deletions
|
@ -442,7 +442,8 @@ struct unifier_fn {
|
|||
if (m_num_steps > m_config.m_max_steps)
|
||||
throw exception(sstream() << "unifier maximum number of steps (" << m_config.m_max_steps << ") exceeded, " <<
|
||||
"the maximum number of steps can be increased by setting the option unifier.max_steps " <<
|
||||
"(remark: the unifier uses higher order unification and unification-hints, which may trigger non-termination");
|
||||
"(remark: the unifier uses higher order unification and unification-hints, " <<
|
||||
"which may trigger non-termination");
|
||||
m_num_steps++;
|
||||
}
|
||||
|
||||
|
@ -1025,7 +1026,7 @@ struct unifier_fn {
|
|||
set_conflict(c.get_justification());
|
||||
return false;
|
||||
}
|
||||
if (!process_constraints(cs))
|
||||
if (!process_constraints(cs, c.get_justification()))
|
||||
return false;
|
||||
type = *t;
|
||||
m_type_map.insert(m, mk_pair(type, justification()));
|
||||
|
@ -1038,7 +1039,7 @@ struct unifier_fn {
|
|||
// and store the new type in m_type_map
|
||||
jst = mk_composite1(jst, type_jst.second);
|
||||
type = type_jst.first;
|
||||
c = update_justification(c, jst);
|
||||
c = update_justification(c, mk_composite1(c.get_justification(), jst));
|
||||
m_type_map.insert(m, mk_pair(type, jst));
|
||||
}
|
||||
unsigned cidx = add_cnstr(c, cnstr_group::ClassInstance);
|
||||
|
|
14
tests/lean/cls_err.lean
Normal file
14
tests/lean/cls_err.lean
Normal file
|
@ -0,0 +1,14 @@
|
|||
import logic
|
||||
|
||||
inductive H [class] (A : Type) :=
|
||||
mk : A → H A
|
||||
|
||||
definition foo {A : Type} {h : H A} : A :=
|
||||
H.rec (λa, a) h
|
||||
|
||||
section
|
||||
parameter A : Type
|
||||
parameter h : H A
|
||||
definition tst : A :=
|
||||
foo
|
||||
end
|
2
tests/lean/cls_err.lean.expected.out
Normal file
2
tests/lean/cls_err.lean.expected.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
cls_err.lean:13:2: error: failed to synthesize placeholder
|
||||
A : Type ⊢ H A
|
|
@ -1,11 +1,2 @@
|
|||
empty.lean:6:25: error: type error in placeholder assigned to
|
||||
Empty
|
||||
placeholder has type
|
||||
Type.{1}
|
||||
but is expected to have type
|
||||
Type.{?M_1}
|
||||
the assignment was attempted when trying to solve
|
||||
type mismatch at definition 'v2', has type
|
||||
Empty
|
||||
but is expected to have type
|
||||
Empty
|
||||
empty.lean:6:25: error: failed to synthesize placeholder
|
||||
⊢ nonempty Empty
|
||||
|
|
Loading…
Add table
Reference in a new issue