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

fix[lang]: fix == and != bytesM folding #4254

Merged
merged 3 commits into from
Sep 26, 2024

Conversation

trocher
Copy link
Contributor

@trocher trocher commented Sep 23, 2024

What I did

Fix [bytesN] [==|!=] [bytesN] to be folded as the operation was computed on python strings and not integer values.

How I did it

Compare lowercase strings instead of strings to be case-insensitive.

How to verify it

The test is explicit.

Before this, the following would hold.

@external
def foo() -> bool:
    a:bytes4 = 0xA1AAB33F
    b:bytes4 = 0xa1aab33f
    return a == b # returns True

@external
def bar() -> bool:
    return 0xA1AAB33F == 0xa1aab33f # returns False

Commit message

`bytesM` literals are not case-sensitive (they represent the same value
no matter if the literal is lower- or upper-case), but the folding
operation was case sensitive.

Description for the changelog

fix == and != bytes folding

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@trocher trocher changed the title fix[lang]: prevent eq/neq bytes folding fix[lang]: fix == and != bytes folding Sep 23, 2024
@charles-cooper charles-cooper changed the title fix[lang]: fix == and != bytes folding fix[lang]: fix == and != bytesM folding Sep 26, 2024
@charles-cooper charles-cooper merged commit d60d31f into vyperlang:master Sep 26, 2024
158 checks passed
charles-cooper added a commit to charles-cooper/vyper that referenced this pull request Oct 5, 2024
`bytesM` literals are not case-sensitive (they represent the same value
no matter if the literal is lower- or upper-case), but the folding
operation was case sensitive.

---------

Co-authored-by: Charles Cooper <[email protected]>
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