0 commits 0 issues 0 pull requests 0 contributors 0 branches 0 releases
Additions: 21 Deletions: 3
vlib/v/fmt/fmt.v
1 max = comments_len + field.name.len
2 }
3 mut ft := f.no_cur_mod(f.table.type_to_str(field.typ))
4- if !ft.contains('C.') && !ft.contains('JS.') {
5+ if !ft.contains('C.') && !ft.contains('JS.') && !ft.contains('fn (') {
6 ft = f.short_module(ft)
7 }
8 field_types << ft
9
vlib/v/fmt/tests/struct_fn_fields_expected.vv
1new file mode 100644
2+import v.ast
3+
4+struct Data {
5+ a fn (string, voidptr) bool
6+ b fn (ast.Stmt, voidptr) bool
7+}
8
vlib/v/fmt/tests/struct_fn_fields_input.vv
1new file mode 100644
2+import v.ast
3+
4+struct Data {
5+ a fn (s string, f voidptr) bool
6+ b fn (stmt ast.Stmt, f voidptr) bool
7+}
8
vlib/v/table/types.v
1 }
2 }
3 .function {
4+ info := sym.info as FnType
5 if !table.is_fmt {
6- info := sym.info as FnType
7 res = table.fn_signature(info.func, type_only: true)
8 } else {
9- res = table.shorten_user_defined_typenames(res, import_aliases)
10+ if res.starts_with('fn (') {
11+ // fn foo ()
12+ res = table.fn_signature(info.func, type_only: true)
13+ } else {
14+ // FnFoo
15+ res = table.shorten_user_defined_typenames(res, import_aliases)
16+ }
17 }
18 }
19 .map {
20