diff --git a/vlib/v/gen/c/fn.v b/vlib/v/gen/c/fn.v index c25f7516a6..9ebbec9ef3 100644 --- a/vlib/v/gen/c/fn.v +++ b/vlib/v/gen/c/fn.v @@ -1718,7 +1718,7 @@ fn (mut g Gen) go_expr(node ast.GoExpr) { } if expr.is_method { receiver_sym := g.table.sym(expr.receiver_type) - name = receiver_sym.name + '_' + name + name = receiver_sym.cname + '_' + name } else if mut expr.left is ast.AnonFn { if expr.left.inherited_vars.len > 0 { fn_var := g.fn_var_signature(expr.left.decl.return_type, expr.left.decl.params.map(it.typ), diff --git a/vlib/v/tests/go_call_fn_return_test.v b/vlib/v/tests/go_call_fn_return_test.v new file mode 100644 index 0000000000..400a0a02a5 --- /dev/null +++ b/vlib/v/tests/go_call_fn_return_test.v @@ -0,0 +1,9 @@ +const text = 'Hello world' + +fn test_go_call_fn_return() { + hex_go := go text.bytes().hex() + hex := text.bytes().hex() + + assert hex == '48656c6c6f20776f726c64' + assert hex_go.wait() == hex +}