mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ast: fix anon fn with nested anon fn argument (#15415)
This commit is contained in:
@ -219,7 +219,7 @@ pub fn (t &Table) fn_type_signature(f &Fn) string {
|
|||||||
} else {
|
} else {
|
||||||
sig += arg_type_sym.str().to_lower().replace_each(['.', '__', '&', '', '[', 'arr_',
|
sig += arg_type_sym.str().to_lower().replace_each(['.', '__', '&', '', '[', 'arr_',
|
||||||
'chan ', 'chan_', 'map[', 'map_of_', ']', '_to_', '<', '_T_', ',', '_', ' ', '',
|
'chan ', 'chan_', 'map[', 'map_of_', ']', '_to_', '<', '_T_', ',', '_', ' ', '',
|
||||||
'>', ''])
|
'>', '', '(', '_', ')', '_'])
|
||||||
}
|
}
|
||||||
if i < f.params.len - 1 {
|
if i < f.params.len - 1 {
|
||||||
sig += '_'
|
sig += '_'
|
||||||
|
12
vlib/v/tests/anon_fn_with_nested_anon_fn_args_test.v
Normal file
12
vlib/v/tests/anon_fn_with_nested_anon_fn_args_test.v
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
module main
|
||||||
|
|
||||||
|
fn test_anon_fn_with_nested_anon_fn_args() {
|
||||||
|
mut xa := fn (x fn (int) string, y int) string {
|
||||||
|
return x(y)
|
||||||
|
}
|
||||||
|
a := xa(fn (i int) string {
|
||||||
|
return 'a' + i.str()
|
||||||
|
}, 8)
|
||||||
|
println(a)
|
||||||
|
assert a == 'a8'
|
||||||
|
}
|
Reference in New Issue
Block a user