feat(frontends/lean): better error localization for 'have'-expressions in tactic mode
This commit is contained in:
parent
946308b187
commit
e0209a1532
3 changed files with 24 additions and 1 deletions
|
@ -222,7 +222,7 @@ static expr parse_begin_end_core(parser & p, pos_info const & pos, name const &
|
||||||
p.next();
|
p.next();
|
||||||
auto pos = p.pos();
|
auto pos = p.pos();
|
||||||
expr t = p.parse_tactic_expr_arg();
|
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_element_annotation(t), pos);
|
||||||
t = p.save_pos(mk_begin_end_annotation(t), pos);
|
t = p.save_pos(mk_begin_end_annotation(t), pos);
|
||||||
add_tac(t, pos);
|
add_tac(t, pos);
|
||||||
|
|
5
tests/lean/have_tactic.lean
Normal file
5
tests/lean/have_tactic.lean
Normal 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
|
18
tests/lean/have_tactic.lean.expected.out
Normal file
18
tests/lean/have_tactic.lean.expected.out
Normal 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
|
Loading…
Reference in a new issue