feat(frontends/lean): make the parser accept (Type -> ...)
Before this commit, the parser would accept only a universe level or a ')' after '(' 'Type' Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
4f3127d3d5
commit
ea6bf224e5
3 changed files with 14 additions and 0 deletions
|
@ -823,6 +823,8 @@ expr parser_imp::parse_type(bool level_expected) {
|
|||
if (level_expected) {
|
||||
if (curr() == scanner::token::RightParen) {
|
||||
return save(Type(), p);
|
||||
} else if (curr() == scanner::token::Arrow) {
|
||||
return parse_arrow(save(Type(), p));
|
||||
} else {
|
||||
return save(mk_type(parse_level()), p);
|
||||
}
|
||||
|
|
5
tests/lean/type0.lean
Normal file
5
tests/lean/type0.lean
Normal file
|
@ -0,0 +1,5 @@
|
|||
check (Type → Type)
|
||||
check (Type → Type) → Type
|
||||
check (Type 1)
|
||||
check ((Type 1) → Type) → Type
|
||||
check ((Type 1) → (Type 2)) → Type
|
7
tests/lean/type0.lean.expected.out
Normal file
7
tests/lean/type0.lean.expected.out
Normal file
|
@ -0,0 +1,7 @@
|
|||
Set: pp::colors
|
||||
Set: pp::unicode
|
||||
Type → Type : (Type 1)
|
||||
(Type → Type) → Type : (Type 1)
|
||||
(Type 1) : (Type 2)
|
||||
((Type 1) → Type) → Type : (Type 2)
|
||||
((Type 1) → (Type 2)) → Type : (Type 3)
|
Loading…
Reference in a new issue