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

parser: fix inline array's element access (#14253)

This commit is contained in:
yuyi
2022-05-02 21:16:32 +08:00
committed by GitHub
parent afbe6bf3a2
commit b9cf2db6a8
3 changed files with 35 additions and 1 deletions

View File

@ -1557,3 +1557,15 @@ fn test_generic_mutable_arrays() {
mut arr := [1, 2, 3]
assert example(mut arr) == [1, 2, 3]
}
struct Ok {}
fn test_inline_array_element_access() {
println([Ok{}][0])
a1 := [Ok{}][0]
assert a1 == Ok{}
println([1][0])
a2 := [1][0]
assert a2 == 1
}