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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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
}