diff --git a/vlib/v/checker/containers.v b/vlib/v/checker/containers.v index 82defb3208cb05..dd50fca57274d0 100644 --- a/vlib/v/checker/containers.v +++ b/vlib/v/checker/containers.v @@ -312,7 +312,7 @@ fn (mut c Checker) check_array_init_default_expr(mut node ast.ArrayInit) { } fn (mut c Checker) check_array_init_para_type(para string, mut expr ast.Expr, pos token.Pos) { - sym := c.table.sym(c.unwrap_generic(c.expr(mut expr))) + sym := c.table.final_sym(c.unwrap_generic(c.expr(mut expr))) if sym.kind !in [.int, .int_literal] { c.error('array ${para} needs to be an int', pos) } diff --git a/vlib/v/tests/array_len_int_alias_test.v b/vlib/v/tests/array_len_int_alias_test.v new file mode 100644 index 00000000000000..0d48ea2bd4a23f --- /dev/null +++ b/vlib/v/tests/array_len_int_alias_test.v @@ -0,0 +1,7 @@ +type Test = int + +fn test_array_len_int_alias() { + x := Test(12) + arr := []int{len: x} + assert arr.len == 12 +}