Skip to content

Commit

Permalink
fix expr.str()
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi98 committed Oct 29, 2024
1 parent 4ee3250 commit 3071fb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions vlib/v/ast/str.v
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/slow_tests/inout/dump_sumtype_of_fntype.out
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 3071fb0

Please sign in to comment.