Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add membership checks in dictionaries and sets #2711

Merged
merged 3 commits into from
Jun 14, 2024

Conversation

advikkabra
Copy link
Collaborator

  • Changed In and NotIn in the AST from compare operators to membership operators
  • Implemented membership checks for dictionaries and sets, need to implement for lists, tuples and strings
  • Searching could be further optimized, but there is a bug.

a: set[str] = {'a', 'b', 'c', 'e', 'f'}
i: str
assert ('a' in a)
# assert ('d' not in a)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try assert not ('d' in a). It should also fail.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be fixed in subsequent PR.

@czgdp1807 czgdp1807 enabled auto-merge June 14, 2024 12:22
@czgdp1807 czgdp1807 merged commit e5308f1 into lcompilers:main Jun 14, 2024
14 checks passed
@advikkabra advikkabra deleted the membership branch July 21, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants