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

cgen: fix array.index() of ref struct (#7652)

This commit is contained in:
yuyi
2020-12-29 01:33:57 +08:00
committed by GitHub
parent 93262353d6
commit 9631eac9c5
2 changed files with 43 additions and 38 deletions

View File

@@ -1278,3 +1278,15 @@ fn test_array_struct_ref_contains() {
println(exists)
assert exists == true
}
fn test_array_struct_ref_index() {
mut coords := []&Coord{}
coord_1 := &Coord{
x: 1
y: 2
z: -1
}
coords << coord_1
println(coords.index(coord_1))
assert coords.index(coord_1) == 0
}