Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • vala vala
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 771
    • Issues 771
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 76
    • Merge requests 76
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • valavala
  • Merge requests
  • !182

Draft: Add the support for "and", "or", "not", "not in", "is not"

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Akarin requested to merge akarin123/vala:andornot into master May 18, 2021
  • Overview 23
  • Commits 18
  • Pipelines 0
  • Changes 13

Add the support for "and", "or", "not", "not in", "is not". A draft to address the issue #888.

"! in" and "is !" is intendedly not supported (may need further opinions).

Tested with the code

class Foo {
}

class Bar {
}

void main() {
    string[] foos = {"foo", "bar", "foobar"};
    
    assert ("foo" in foos);
    assert ("barfoo" not in foos);
    assert (("barfoo" not in foos) and ("foo" in foos));
    assert (("barfoo" not in foos) or ("foo" not in foos));
    assert (not ("foobar" not in foos));
    
    Foo foo = new Foo();
    Bar bar = new Bar();
    assert (foo is not Bar and bar is not Foo);
    assert (not (foo is not Foo) or bar is Foo);
}
Edited May 22, 2021 by Akarin
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: andornot