1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: fix using 'array' name variable in array_init (#16168)

This commit is contained in:
yuyi
2022-10-24 03:23:15 +08:00
committed by GitHub
parent 340611c298
commit 7b8044b8c4
2 changed files with 8 additions and 2 deletions

View File

@@ -1601,3 +1601,9 @@ fn test_2d_array_init_with_it() {
a := [][]int{len: 6, init: f(it, 2 * it)}
assert a == [[0, 0], [1, 2], [2, 4], [3, 6], [4, 8], [5, 10]]
}
fn test_using_array_name_variable() {
array := []int{len: 4, init: it}
println(array)
assert array == [0, 1, 2, 3]
}