Skip to content

Commit 400ab78

Browse files
authored
ast: fix fixed array typedef generation issue (#11962)
1 parent c75271f commit 400ab78

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

vlib/v/ast/table.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ pub fn (t &Table) fn_type_signature(f &Fn) string {
207207
// TODO: for now ignore mut/pts in sig for now
208208
typ := arg.typ.set_nr_muls(0)
209209
arg_type_sym := t.get_type_symbol(typ)
210-
sig += arg_type_sym.str().to_lower().replace_each(['.', '__', '&', '', '[]', 'arr_', 'chan ',
210+
sig += arg_type_sym.str().to_lower().replace_each(['.', '__', '&', '', '[', 'arr_', 'chan ',
211211
'chan_', 'map[', 'map_of_', ']', '_to_', '<', '_T_', ',', '_', ' ', '', '>', ''])
212212
if i < f.params.len - 1 {
213213
sig += '_'

vlib/v/tests/anon_fn_with_array_arguments_test.v

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
struct Test {
2+
fn_test fn (x int, y [10]int, z []int) bool = fixed_array_fn
3+
}
4+
5+
fn fixed_array_fn(x int, y [10]int, z []int) bool {
6+
return true
7+
}
8+
9+
fn test_anon_fn_with_fixed_array_arguments() {
10+
assert true
11+
}
12+
113
fn fn_arg(f fn ([]int) int) int {
214
return f([1, 2, 3])
315
}

0 commit comments

Comments
 (0)