From cabbf93faae148707ade81126a5c71db522a44aa Mon Sep 17 00:00:00 2001 From: yuyi Date: Mon, 29 Mar 2021 17:15:59 +0800 Subject: [PATCH] cgen: fix generic_struct str() (#9504) --- vlib/v/gen/c/auto_str_methods.v | 2 +- vlib/v/tests/generics_return_generics_struct_test.v | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/gen/c/auto_str_methods.v b/vlib/v/gen/c/auto_str_methods.v index 1f9416e38d..f853a2cf21 100644 --- a/vlib/v/gen/c/auto_str_methods.v +++ b/vlib/v/gen/c/auto_str_methods.v @@ -475,7 +475,7 @@ fn (mut g Gen) gen_str_for_struct(info table.Struct, styp string, str_fn_name st // TODO: this is a bit hacky. styp shouldn't be even parsed with _T_ // use something different than g.typ for styp clean_struct_v_type_name = - clean_struct_v_type_name.replace('_T_', '<').replace('_', ', ').replace('Array', 'array') + + clean_struct_v_type_name.replace('_Array', '_array').replace('_T_', '<').replace('_', ', ') + '>' } clean_struct_v_type_name = util.strip_main_name(clean_struct_v_type_name) diff --git a/vlib/v/tests/generics_return_generics_struct_test.v b/vlib/v/tests/generics_return_generics_struct_test.v index 7b8b101aab..fde0fcb134 100644 --- a/vlib/v/tests/generics_return_generics_struct_test.v +++ b/vlib/v/tests/generics_return_generics_struct_test.v @@ -45,7 +45,7 @@ fn test_generics_with_generics_struct_string() { it := iter(data) println(it) ret := '$it' - assert ret.contains('arrayIterator{') + assert ret.contains('ArrayIterator{') assert ret.contains("data: ['foo', 'bar']") assert ret.contains('index: 11') }