fix(frontends/lean/definition_cmds): copy position for equation in meta definitions

Fixes #1377.
This commit is contained in:
Gabriel Ebner 2017-02-17 20:57:12 +01:00 committed by Leonardo de Moura
parent a36e20f0cd
commit 0c2878e509
3 changed files with 13 additions and 1 deletions

View file

@ -186,7 +186,7 @@ static expr_pair parse_definition(parser & p, buffer<name> & lp_names, buffer<ex
p.add_local(fn);
val = p.parse_expr();
/* add fake equation */
expr eqn = mk_equation(fn, val);
expr eqn = copy_tag(val, mk_equation(fn, val));
buffer<expr> eqns;
eqns.push_back(eqn);
val = mk_equations(p, fn, scope2.get_name(), eqns, {}, header_pos);

View file

@ -0,0 +1,4 @@
meta def f (x : nat) : nat :=
tt -- type error should be reported here
check nat

View file

@ -0,0 +1,8 @@
meta_equation_pos.lean:2:0: error: equation type mismatch, expression
tt
has type
bool
but is expected to have type
meta_equation_pos.lean:1:9: warning: declaration 'f' uses sorry
: Type