diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index d66eb42ac5..de33747cbc 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -3486,7 +3486,7 @@ fn (mut g Gen) gen_str_for_type_with_styp(typ table.Type, styp string) string { if typ.flag_is(.variadic) { varg_already_generated_key := 'varg_$already_generated_key' if varg_already_generated_key !in g.str_types { - g.gen_str_for_varg(styp, str_fn_name) + g.gen_str_for_varg(styp, str_fn_name, sym_has_str_method) g.str_types << varg_already_generated_key } return 'varg_$str_fn_name' @@ -3762,13 +3762,18 @@ fn (mut g Gen) gen_str_for_map(info table.Map, styp, str_fn_name string) { g.auto_str_funcs.writeln('}') } -fn (mut g Gen) gen_str_for_varg(styp, str_fn_name string) { +fn (mut g Gen) gen_str_for_varg(styp, str_fn_name string, has_str_method bool) { g.definitions.writeln('string varg_${str_fn_name}(varg_$styp it); // auto') g.auto_str_funcs.writeln('string varg_${str_fn_name}(varg_$styp it) {') g.auto_str_funcs.writeln('\tstrings__Builder sb = strings__new_builder(it.len);') g.auto_str_funcs.writeln('\tstrings__Builder_write(&sb, tos_lit("["));') g.auto_str_funcs.writeln('\tfor(int i=0; i