diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index d724257b53..765ac9d34a 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -2168,8 +2168,9 @@ pub fn (mut c Checker) expr(node_ ast.Expr) ast.Type { return ast.void_type } - tsym := c.table.sym(node.expr_type) - c.table.dumps[int(node.expr_type)] = tsym.cname + unwrapped_expr_type := c.unwrap_generic(node.expr_type) + tsym := c.table.sym(unwrapped_expr_type) + c.table.dumps[int(unwrapped_expr_type)] = tsym.cname node.cname = tsym.cname return node.expr_type } diff --git a/vlib/v/tests/inout/dump_generic_fn_mut_arg.out b/vlib/v/tests/inout/dump_generic_fn_mut_arg.out new file mode 100644 index 0000000000..e8e6b5b7e7 --- /dev/null +++ b/vlib/v/tests/inout/dump_generic_fn_mut_arg.out @@ -0,0 +1 @@ +[vlib/v/tests/inout/dump_generic_fn_mut_arg.vv:11] t: &Reptile{} diff --git a/vlib/v/tests/inout/dump_generic_fn_mut_arg.vv b/vlib/v/tests/inout/dump_generic_fn_mut_arg.vv new file mode 100644 index 0000000000..35478ff40d --- /dev/null +++ b/vlib/v/tests/inout/dump_generic_fn_mut_arg.vv @@ -0,0 +1,12 @@ +module main + +pub struct Reptile {} + +fn main() { + mut r := Reptile{} + do(mut r) +} + +pub fn do(mut t T) { + dump(t) +}