diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 996309b255..3cb1759454 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -666,7 +666,7 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl) { mut field_types := []string{cap: node.fields.len} for i, field in node.fields { mut ft := f.no_cur_mod(f.table.type_to_str(field.typ)) - if !ft.contains('C.') && !ft.contains('JS.') && !ft.contains('fn (') { + if !ft.contains('C.') && !ft.contains('JS.') && !ft.contains('fn (') && !ft.contains('chan') { ft = f.short_module(ft) } field_types << ft diff --git a/vlib/v/fmt/tests/chan_init_keep.vv b/vlib/v/fmt/tests/chan_init_keep.vv index e8d00e6d7f..47eaac6b5a 100644 --- a/vlib/v/fmt/tests/chan_init_keep.vv +++ b/vlib/v/fmt/tests/chan_init_keep.vv @@ -1,3 +1,9 @@ +import some_mod + +struct ChanFieldType { + c chan some_mod.Type +} + struct FSMEvent { x int }