fix(frontends/lean/builtin_exprs): 'using' expression should make local constant available for tactics
This commit is contained in:
parent
fcd67649ed
commit
666f697d24
1 changed files with 10 additions and 3 deletions
|
@ -233,13 +233,19 @@ static expr parse_proof(parser & p, expr const & prop) {
|
|||
p.next();
|
||||
parser::local_scope scope(p);
|
||||
buffer<expr> locals;
|
||||
buffer<expr> new_locals;
|
||||
while (!p.curr_is_token(get_comma_tk())) {
|
||||
auto id_pos = p.pos();
|
||||
expr l = p.parse_expr();
|
||||
if (!is_local(l))
|
||||
throw parser_error("invalid 'using' declaration for 'have', local expected", id_pos);
|
||||
p.add_local(l);
|
||||
expr new_l = l;
|
||||
binder_info bi = local_info(l);
|
||||
if (!bi.is_contextual())
|
||||
new_l = update_local(l, bi.update_contextual(true));
|
||||
p.add_local(new_l);
|
||||
locals.push_back(l);
|
||||
new_locals.push_back(new_l);
|
||||
}
|
||||
p.next(); // consume ','
|
||||
expr pr = parse_proof(p, prop);
|
||||
|
@ -247,7 +253,8 @@ static expr parse_proof(parser & p, expr const & prop) {
|
|||
while (i > 0) {
|
||||
--i;
|
||||
expr l = locals[i];
|
||||
pr = p.save_pos(Fun(l, pr), using_pos);
|
||||
expr new_l = new_locals[i];
|
||||
pr = p.save_pos(Fun(new_l, pr), using_pos);
|
||||
pr = p.save_pos(mk_app(pr, l), using_pos);
|
||||
}
|
||||
return pr;
|
||||
|
|
Loading…
Reference in a new issue