fix(frontends/lean/structure_cmd): allow default values for function fields

This commit is contained in:
Leonardo de Moura 2017-03-06 07:41:42 -08:00
parent 156e5603d6
commit 045fe4ad25
2 changed files with 8 additions and 1 deletions

View file

@ -895,7 +895,8 @@ struct structure_cmd_fn {
/* TODO(Leo): add helper function for adding definition.
It should unfold_untrusted_macros */
expr decl_type = unfold_untrusted_macros(m_env, Pi(args, mlocal_type(field.first)));
expr decl_value = unfold_untrusted_macros(m_env, Fun(args, *field.second));
expr val = mk_app(m_ctx, get_id_name(), *field.second);
expr decl_value = unfold_untrusted_macros(m_env, Fun(args, val));
name_set used_univs;
used_univs = collect_univ_params(decl_value, used_univs);
used_univs = collect_univ_params(decl_type, used_univs);

View file

@ -0,0 +1,6 @@
structure foo :=
(bar : Π n : , := id)
(baz : Π {n : }, := id)
(bat : Π n : , := λ n, n)
check {foo.}