After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 605157 - Arrays of types doesnt support 'in' operator
Arrays of types doesnt support 'in' operator
Status: RESOLVED DUPLICATE of bug 602511
Product: vala
Classification: Core
Component: Arrays
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-12-21 18:35 UTC by pancake
Modified: 2010-03-26 19:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description pancake 2009-12-21 18:35:18 UTC
The 'in' operator does not works for arrays of basic types like int, string, etc.. it can be implemented as in lists with a comparator function:

Here's a sample code that fails to compile: (aka test case)

---
void main () {
        int[] foo = { 1, 3, 4, 10 };
        if (3 in foo) {
                print ("integer found\n");
        }
        string[] bar = { "foo", "bar", "cow" };
        if ("foo" in bar) {
                print ("string found\n");
        }
}
---
Comment 1 Jürg Billeter 2010-03-26 19:20:47 UTC
Thanks for taking the time to report this bug.
This particular bug has already been reported into our bug tracking system, but we are happy to tell you that the problem has already been fixed. It should be solved in the next software version. You may want to check for a software upgrade.

*** This bug has been marked as a duplicate of bug 602511 ***