diff --git a/vlib/v/ast/str.v b/vlib/v/ast/str.v index 5c076d4052d068..6fbcbc7a819316 100644 --- a/vlib/v/ast/str.v +++ b/vlib/v/ast/str.v @@ -450,7 +450,8 @@ pub fn (x &Expr) str() string { return x.val.str() } CastExpr { - return '${util.strip_main_name(global_table.type_to_str(x.typ))}(${x.expr.str()})' + type_name := util.strip_main_name(global_table.type_to_str(x.typ)) + return '${type_name}(${x.expr.str()})' } CallExpr { sargs := args2str(x.args) @@ -513,7 +514,7 @@ pub fn (x &Expr) str() string { return x.cached_name } unsafe { - x.cached_name = x.name.clone() + x.cached_name = util.strip_main_name(x.name.clone()) } return x.cached_name } diff --git a/vlib/v/slow_tests/inout/dump_sumtype_of_fntype.out b/vlib/v/slow_tests/inout/dump_sumtype_of_fntype.out index e0f5280898702b..40a1900f6d62c6 100644 --- a/vlib/v/slow_tests/inout/dump_sumtype_of_fntype.out +++ b/vlib/v/slow_tests/inout/dump_sumtype_of_fntype.out @@ -1 +1 @@ -[vlib/v/slow_tests/inout/dump_sumtype_of_fntype.vv:10] main.MyFnSumtype(main.f): MyFnSumtype(fn (int) v.ast.Expr) +[vlib/v/slow_tests/inout/dump_sumtype_of_fntype.vv:10] MyFnSumtype(f): MyFnSumtype(fn (int) v.ast.Expr)