mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
parser: fix inline array's element access (#14253)
This commit is contained in:
parent
afbe6bf3a2
commit
b9cf2db6a8
3 changed files with 35 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue