diff --git a/vlib/v/fmt/struct.v b/vlib/v/fmt/struct.v index 532fd27fe7..2d0dea652d 100644 --- a/vlib/v/fmt/struct.v +++ b/vlib/v/fmt/struct.v @@ -178,7 +178,7 @@ pub fn (mut f Fmt) struct_init(node ast.StructInit) { defer { f.is_struct_init = struct_init_save } - + f.mark_types_import_as_used(node.typ) type_sym := f.table.sym(node.typ) // f.write('') mut name := type_sym.name diff --git a/vlib/v/fmt/tests/import_with_symbol_of_struct_keep.vv b/vlib/v/fmt/tests/import_with_symbol_of_struct_keep.vv new file mode 100644 index 0000000000..22b6bc145d --- /dev/null +++ b/vlib/v/fmt/tests/import_with_symbol_of_struct_keep.vv @@ -0,0 +1,5 @@ +import datatypes { Stack } + +fn main() { + stack := Stack{} +}