1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: remove "main" from inline sum type str (#12963)

This commit is contained in:
Daniel Däschle 2021-12-25 21:58:45 +01:00 committed by GitHub
parent 35282396ec
commit 10f63b3cd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -436,7 +436,7 @@ fn (mut g Gen) gen_str_for_union_sum_type(info ast.SumType, styp string, str_fn_
fn_builder.writeln('static string indent_${str_fn_name}($styp x, int indent_count) {')
mut clean_sum_type_v_type_name := ''
if info.is_anon {
variant_names := info.variants.map(g.table.sym(it).name)
variant_names := info.variants.map(util.strip_main_name(g.table.sym(it).name))
clean_sum_type_v_type_name = '(${variant_names.join(' | ')})'
} else {
clean_sum_type_v_type_name = styp.replace('__', '.')