Skip to content

Commit

Permalink
vfmt: fix fmt for map value type using select import symbol (fix #20449
Browse files Browse the repository at this point in the history
…) (#20451)
  • Loading branch information
felipensp committed Jan 9, 2024
1 parent ee95e23 commit ee74511
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions vlib/v/fmt/fmt.v
Expand Up @@ -2629,6 +2629,7 @@ pub fn (mut f Fmt) map_init(node ast.MapInit) {
sym := f.table.sym(node.typ)
info := sym.info as ast.Map
f.mark_types_import_as_used(info.key_type)
f.mark_types_import_as_used(info.value_type)
f.write(f.table.type_to_str_using_aliases(node.typ, f.mod2alias))
}
if node.pos.line_nr == node.pos.last_line {
Expand Down
5 changes: 5 additions & 0 deletions vlib/v/fmt/tests/import_selective_map_keep.vv
@@ -0,0 +1,5 @@
import time { Duration }

fn main() {
println(map[string]Duration{})
}

0 comments on commit ee74511

Please sign in to comment.