feat(frontends/lean/decl_cmds): allow 'empty' set of pattern matching equations
This commit is contained in:
parent
8e9ccf8b6f
commit
28487ede3b
3 changed files with 63 additions and 48 deletions
|
@ -119,7 +119,7 @@
|
||||||
;; modifiers
|
;; modifiers
|
||||||
(,(rx (or "\[persistent\]" "\[notation\]" "\[visible\]" "\[instance\]" "\[class\]" "\[parsing-only\]"
|
(,(rx (or "\[persistent\]" "\[notation\]" "\[visible\]" "\[instance\]" "\[class\]" "\[parsing-only\]"
|
||||||
"\[coercion\]" "\[reducible\]" "\[irreducible\]" "\[semireducible\]" "\[quasireducible\]" "\[wf\]"
|
"\[coercion\]" "\[reducible\]" "\[irreducible\]" "\[semireducible\]" "\[quasireducible\]" "\[wf\]"
|
||||||
"\[whnf\]" "\[multiple-instances\]"
|
"\[whnf\]" "\[multiple-instances\]" "\[none\]"
|
||||||
"\[decls\]" "\[declarations\]" "\[all-transparent\]" "\[coercions\]" "\[classes\]"
|
"\[decls\]" "\[declarations\]" "\[all-transparent\]" "\[coercions\]" "\[classes\]"
|
||||||
"\[notations\]" "\[abbreviations\]" "\[begin-end-hints\]" "\[tactic-hints\]" "\[reduce-hints\]"))
|
"\[notations\]" "\[abbreviations\]" "\[begin-end-hints\]" "\[tactic-hints\]" "\[reduce-hints\]"))
|
||||||
. 'font-lock-doc-face)
|
. 'font-lock-doc-face)
|
||||||
|
|
|
@ -604,6 +604,11 @@ expr parse_equations(parser & p, name const & n, expr const & type, buffer<name>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
check_eqn_prefix(p);
|
check_eqn_prefix(p);
|
||||||
|
if (p.curr_is_token(get_none_tk())) {
|
||||||
|
// no equations have been provided
|
||||||
|
p.next();
|
||||||
|
eqns.push_back(Fun(fns, mk_no_equation(), p));
|
||||||
|
} else {
|
||||||
for (expr const & fn : fns)
|
for (expr const & fn : fns)
|
||||||
p.add_local(fn);
|
p.add_local(fn);
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -658,6 +663,7 @@ expr parse_equations(parser & p, name const & n, expr const & type, buffer<name>
|
||||||
p.next();
|
p.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (p.curr_is_token(get_wf_tk())) {
|
if (p.curr_is_token(get_wf_tk())) {
|
||||||
auto pos = p.pos();
|
auto pos = p.pos();
|
||||||
p.next();
|
p.next();
|
||||||
|
|
9
tests/lean/run/empty_eq.lean
Normal file
9
tests/lean/run/empty_eq.lean
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import data.fin
|
||||||
|
open nat
|
||||||
|
open fin
|
||||||
|
|
||||||
|
definition case0 {C : fin zero → Type} : Π (f : fin zero), C f
|
||||||
|
| [none]
|
||||||
|
|
||||||
|
|
||||||
|
print definition case0
|
Loading…
Reference in a new issue