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

checker: fix dumping generic fn mut argument (#15384)

This commit is contained in:
yuyi 2022-08-09 12:46:55 +08:00 committed by GitHub
parent d4b622bdc2
commit 7be9963a41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -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
}

View File

@ -0,0 +1 @@
[vlib/v/tests/inout/dump_generic_fn_mut_arg.vv:11] t: &Reptile{}

View File

@ -0,0 +1,12 @@
module main
pub struct Reptile {}
fn main() {
mut r := Reptile{}
do(mut r)
}
pub fn do<T>(mut t T) {
dump(t)
}