diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 48dcb35d5b..760278248e 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -590,7 +590,7 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl) { if comments_len + field.name.len > max { max = comments_len + field.name.len } - ft := f.type_to_str(field.typ) + ft := f.table.type_to_str(field.typ) field_types << ft if ft.len > max_type { max_type = ft.len @@ -886,18 +886,7 @@ pub fn (mut f Fmt) expr(node ast.Expr) { } ast.MapInit { if node.keys.len == 0 { - mut ktyp := node.key_type - mut vtyp := node.value_type - if vtyp == 0 { - typ_sym := f.table.get_type_symbol(node.typ) - minfo := typ_sym.info as table.Map - ktyp = minfo.key_type - vtyp = minfo.value_type - } - f.write('map[') - f.write(f.type_to_str(ktyp)) - f.write(']') - f.write(f.type_to_str(vtyp)) + f.write(f.table.type_to_str(node.typ)) f.write('{}') return } diff --git a/vlib/v/fmt/tests/proto_module_importing_vproto_keep.vv b/vlib/v/fmt/tests/proto_module_importing_vproto_keep.vv index ac04eb5c41..2bca23416a 100644 --- a/vlib/v/fmt/tests/proto_module_importing_vproto_keep.vv +++ b/vlib/v/fmt/tests/proto_module_importing_vproto_keep.vv @@ -20,6 +20,10 @@ struct Abcde { p4 []&Xyz p5 map[string]Xyz p6 map[string]&Xyz + p7 map[string]map[string]map[string]&Xyz + // + p8 map[string]map[string]map[string]map[string]&Xyz + p9 map[string]map[string]map[string]map[string]&vproto.Xyz } fn abc() { @@ -27,4 +31,5 @@ fn abc() { mut a := []vproto.Xyz{} a << x a << vproto.Xyz{3} + z := map[string]map[string]map[string]map[string]&vproto.Xyz{} }