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:
Leonardo de Moura 2014-01-29 15:22:37 -08:00
parent 4f3127d3d5
commit ea6bf224e5
3 changed files with 14 additions and 0 deletions

View file

@ -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
View 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

View 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)