1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vfmt: fix table.type_to_str(), keep map[string]mod.Type in fn args

This commit is contained in:
Delyan Angelov 2020-06-10 17:12:55 +03:00
parent acf0b84523
commit 3a369f513c

View File

@ -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 {