add typeof test for fn (#3832)

pull/3840/head
lydiandy 2020-02-25 18:14:59 +08:00 committed by GitHub
parent 200f25a38f
commit d4ffed89c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -72,3 +72,16 @@ fn test_typeof_on_sumtypes_of_structs() {
assert typeof(c) == 'BoolExpr'
assert typeof(d) == 'UnaryExpr'
}
type MyFn fn(int) int
type MyFn2 fn()
fn myfn(i int) int {
return i
}
fn myfn2() {}
fn test_typeof_on_fn() {
assert typeof(myfn) == 'fn (int) int'
assert typeof(myfn2) == 'fn ()'
}