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

cgen: fix in array of struct error (fix #7452) (#7463)

This commit is contained in:
yuyi
2020-12-23 09:32:19 +08:00
committed by GitHub
parent a2cd1b163c
commit 70c136441b
2 changed files with 156 additions and 53 deletions

View File

@@ -1195,3 +1195,34 @@ fn test_any_type_array_contains() {
assert [2] in c
assert [3] !in c
}
struct Person {
name string
nums []int
kv map[string]string
}
fn test_struct_array_of_multi_type_in() {
ivan := Person{
name: 'ivan'
nums: [1, 2, 3]
kv: {
'aaa': '111'
}
}
people := [Person{
name: 'ivan'
nums: [1, 2, 3]
kv: {
'aaa': '111'
}
}, Person{
name: 'bob'
nums: [2]
kv: {
'bbb': '222'
}
}]
println(ivan in people)
assert ivan in people
}