Add function types

main
trivernis 4 months ago
parent 1b1cf7dd6e
commit 908d6e6a5f
Signed by: Trivernis
GPG Key ID: 7E6D18B61C8D2F4B

@ -8,7 +8,7 @@ block = { "{" ~ MLF ~ block_line ~ MLF ~ "}" }
block_line = _{ expr | (statement ~ MLF)* }
type_decl = { "type" ~ #name = type_ident ~ "=" ~ type_expr }
type_expr = { type_term | func | type_ident }
type_expr = { func | type_term | type_ident }
type_term = _{ tuple | rec | enum | type_ident }
tuple = { "#(" ~ MLF ~ tuple_entry* ~ MLF ~ ")" }

@ -75,3 +75,10 @@ fn it_parses_generics() {
panic!("{e}")
}
}
#[test]
fn it_parses_functions() {
if let Err(e) = (*TESTER).evaluate_strict("functions") {
panic!("{e}")
}
}

@ -0,0 +1,37 @@
Recs Test
======
type MyFn = Num -> Num -> Str
======
(file
(statement
(type_decl
(type_ident
(ident: "MyFn")
)
(type_expr
(func
(type_ident
(ident: "Num")
)
(type_expr
(func
(type_ident
(ident: "Num")
)
(type_expr
(type_ident
(ident: "Str")
)
)
)
)
)
)
)
)
(EOI: "")
)
Loading…
Cancel
Save