fix(frontends/lean/structure_cmd): allow default values for function fields
This commit is contained in:
parent
156e5603d6
commit
045fe4ad25
2 changed files with 8 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
6
tests/lean/run/fn_default.lean
Normal file
6
tests/lean/run/fn_default.lean
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
structure foo :=
|
||||
(bar : Π n : ℕ, ℕ := id)
|
||||
(baz : Π {n : ℕ}, ℕ := id)
|
||||
(bat : Π n : ℕ, ℕ := λ n, n)
|
||||
|
||||
check {foo.}
|
||||
Loading…
Add table
Reference in a new issue