cgen: fix generic_struct str() (#9504)

pull/9510/head
yuyi 2021-03-29 17:15:59 +08:00 committed by GitHub
parent 736df955ff
commit cabbf93faa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

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

View File

@ -45,7 +45,7 @@ fn test_generics_with_generics_struct_string() {
it := iter<string>(data)
println(it)
ret := '$it'
assert ret.contains('arrayIterator<string>{')
assert ret.contains('ArrayIterator<string>{')
assert ret.contains("data: ['foo', 'bar']")
assert ret.contains('index: 11')
}