1
0
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:
yuyi 2022-08-12 22:24:23 +08:00 committed by GitHub
parent 70e3c72619
commit 9c96b13f9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -219,7 +219,7 @@ pub fn (t &Table) fn_type_signature(f &Fn) string {
} else {
sig += arg_type_sym.str().to_lower().replace_each(['.', '__', '&', '', '[', 'arr_',
'chan ', 'chan_', 'map[', 'map_of_', ']', '_to_', '<', '_T_', ',', '_', ' ', '',
'>', ''])
'>', '', '(', '_', ')', '_'])
}
if i < f.params.len - 1 {
sig += '_'

View 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'
}