diff --git a/vlib/compiler/tests/typeof_test.v b/vlib/compiler/tests/typeof_test.v index b3a1712a20..1c12c6817e 100644 --- a/vlib/compiler/tests/typeof_test.v +++ b/vlib/compiler/tests/typeof_test.v @@ -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 ()' +} \ No newline at end of file