fix(frontends/lean/parser): associated position with 'type' placeholder

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-10-31 16:27:36 -07:00
parent aa99ac6618
commit 96dcd003c6
4 changed files with 24 additions and 2 deletions

View file

@ -721,7 +721,7 @@ class parser::imp {
if (type)
arg_type = lift_free_vars(type, i);
else
arg_type = mk_placholder();
arg_type = save(mk_placholder(), names[i].first);
result[sz + i] = std::make_tuple(names[i].first, names[i].second, arg_type, implicit_decl);
}
}

View file

@ -269,7 +269,7 @@ class elaborator::imp {
}
/**
\brief Auxiliary method for pushing a new constraint to the given constraint queue.
\brief Push a new constraint to the given constraint queue.
If \c is_eq is true, then a equality constraint is created, otherwise a convertability constraint is created.
*/
void push_new_constraint(cnstr_queue & q, bool is_eq, context const & new_ctx, expr const & new_a, expr const & new_b, justification const & new_jst) {
@ -279,6 +279,10 @@ class elaborator::imp {
q.push_front(mk_convertible_constraint(new_ctx, new_a, new_b, new_jst));
}
/**
\brief Push a new equality constraint <tt>new_ctx |- new_a == new_b</tt> into the given contraint queue using
justification \c new_jst.
*/
void push_new_eq_constraint(cnstr_queue & q, context const & new_ctx, expr const & new_a, expr const & new_b, justification const & new_jst) {
push_new_constraint(q, true, new_ctx, new_a, new_b, new_jst);
}

8
tests/lean/ty1.lean Normal file
View file

@ -0,0 +1,8 @@
Variable i : Int.
Check fun x, x + i
Check fun x, x + 1
Check fun x, x
Check fun x y, y + i + 1 + x
Check (fun x, x) i
Check (fun x, x i) (fun x y, x + 1 + y)
Check (fun x, x) (fun x y, x + 1 + y)

View file

@ -0,0 +1,10 @@
Set: pp::colors
Set: pp::unicode
Assumed: i
λ x : , x + i :
λ x : , x + 1 :
Error (line: 4, pos: 10) unexpected metavariable occurrence
λ x y : , y + i + 1 + x :
(λ x : , x) i :
(λ x : , x i) (λ x y : , x + 1 + y) :
(λ x : , x) (λ x y : , x + 1 + y) :