From 3a369f513c850ed744214de5b81870edd6298af1 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 10 Jun 2020 17:12:55 +0300 Subject: [PATCH] vfmt: fix table.type_to_str(), keep map[string]mod.Type in fn args --- vlib/v/table/atypes.v | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vlib/v/table/atypes.v b/vlib/v/table/atypes.v index 1fcc733cff..5ba36a5552 100644 --- a/vlib/v/table/atypes.v +++ b/vlib/v/table/atypes.v @@ -700,8 +700,10 @@ pub fn (table &Table) type_to_str(t Type) string { if sym.kind == .array || 'array_' in res { res = res.replace('array_', '[]') } + mut map_start := '' if sym.kind == .map || 'map_string_' in res { res = res.replace('map_string_', 'map[string]') + map_start = 'map[string]' } // mod.submod.submod2.Type => submod2.Type if res.contains('.') { @@ -712,6 +714,9 @@ pub fn (table &Table) type_to_str(t Type) string { if sym.kind == .array && !res.starts_with('[]') { res = '[]' + res } + if sym.kind == .map && !res.starts_with('map') { + res = map_start + res + } } nr_muls := t.nr_muls() if nr_muls > 0 {