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:
parent
d4b622bdc2
commit
7be9963a41
@ -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
|
||||
}
|
||||
|
1
vlib/v/tests/inout/dump_generic_fn_mut_arg.out
Normal file
1
vlib/v/tests/inout/dump_generic_fn_mut_arg.out
Normal file
@ -0,0 +1 @@
|
||||
[vlib/v/tests/inout/dump_generic_fn_mut_arg.vv:11] t: &Reptile{}
|
12
vlib/v/tests/inout/dump_generic_fn_mut_arg.vv
Normal file
12
vlib/v/tests/inout/dump_generic_fn_mut_arg.vv
Normal 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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user