ast: fix fixed array typedef generation issue (#11962)

pull/11971/head
Ekopalypse 2021-09-24 16:01:42 +02:00 committed by GitHub
parent c75271fcb7
commit 400ab7876b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -207,7 +207,7 @@ pub fn (t &Table) fn_type_signature(f &Fn) string {
// TODO: for now ignore mut/pts in sig for now
typ := arg.typ.set_nr_muls(0)
arg_type_sym := t.get_type_symbol(typ)
sig += arg_type_sym.str().to_lower().replace_each(['.', '__', '&', '', '[]', 'arr_', 'chan ',
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

@ -1,3 +1,15 @@
struct Test {
fn_test fn (x int, y [10]int, z []int) bool = fixed_array_fn
}
fn fixed_array_fn(x int, y [10]int, z []int) bool {
return true
}
fn test_anon_fn_with_fixed_array_arguments() {
assert true
}
fn fn_arg(f fn ([]int) int) int {
return f([1, 2, 3])
}