feat(frontends/lean): better error localization for 'have'-expressions in tactic mode

This commit is contained in:
Leonardo de Moura 2015-07-23 18:07:57 -07:00
parent 946308b187
commit e0209a1532
3 changed files with 24 additions and 1 deletions

View file

@ -222,7 +222,7 @@ static expr parse_begin_end_core(parser & p, pos_info const & pos, name const &
p.next();
auto pos = p.pos();
expr t = p.parse_tactic_expr_arg();
t = p.mk_app(get_rexact_tac_fn(), t, pos);
t = p.mk_app(get_exact_tac_fn(), t, pos);
t = p.save_pos(mk_begin_end_element_annotation(t), pos);
t = p.save_pos(mk_begin_end_annotation(t), pos);
add_tac(t, pos);

View file

@ -0,0 +1,5 @@
example (a b c : nat) : a = b → b = c → a = c :=
begin
intro h₁ h₂,
have a = c, from eq.trans h₁ _,
end

View file

@ -0,0 +1,18 @@
have_tactic.lean:4:31: error: don't know how to synthesize placeholder
a b c : nat,
h₁ : a = b,
h₂ : b = c
⊢ b = c
have_tactic.lean:4:19: error:invalid 'exact' tactic, term still contains metavariables after elaboration
eq.trans h₁ ?M_1
proof state:
a b c : nat,
h₁ : a = b,
h₂ : b = c
⊢ a = c
have_tactic.lean:5:0: error: don't know how to synthesize placeholder
a b c : nat
⊢ a = b → b = c → a = c
have_tactic.lean:5:0: error: failed to add declaration 'example' to environment, value has metavariables
remark: set 'formatter.hide_full_terms' to false to see the complete term
?M_1