From e42db5bee282e569bb1e17a2858dc39731b3d612 Mon Sep 17 00:00:00 2001 From: yuyi Date: Wed, 24 Nov 2021 02:11:51 +0800 Subject: [PATCH] ast: fix vtl compile error of generic array type cname (#12555) --- vlib/v/ast/table.v | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vlib/v/ast/table.v b/vlib/v/ast/table.v index c56ac6b663..994c7480ac 100644 --- a/vlib/v/ast/table.v +++ b/vlib/v/ast/table.v @@ -812,7 +812,12 @@ pub fn (t &Table) array_cname(elem_type Type) string { if elem_type.is_ptr() { res = '_ptr'.repeat(elem_type.nr_muls()) } - return 'Array_$elem_type_sym.cname' + res + if elem_type_sym.cname.contains('<') { + type_name := elem_type_sym.cname.replace_each(['<', '_T_', ', ', '_', '>', '']) + return 'Array_$type_name' + res + } else { + return 'Array_$elem_type_sym.cname' + res + } } // array_fixed_source_name generates the original name for the v source.