-
-
Notifications
You must be signed in to change notification settings - Fork 814
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[parser]: fix bad tokenization of hex strings #4406
base: master
Are you sure you want to change the base?
fix[parser]: fix bad tokenization of hex strings #4406
Conversation
this commit fixes parsing of hex strings. it leaves the locations unmodified as to minimize the changes to locations in the source code
632284e
to
dc593d9
Compare
please add tests for all 3 error cases as they are listed in #4405 |
not very informative: def test() -> Bytes[10]:
a: Bytes[10] = x'gloglo'
return a
|
crashes on our grammar: def test_hexstring(get_contract):
src = """
@external
def test() -> Bytes[10]:
a: Bytes[10] = x \
'baba'
return a
"""
c = get_contract(src)
assert c.test() == b'\xba\xba' |
what about we pop the hex_string_location in parse and assert at the end that the locations are empty? as a sanity check to prevent confusion between str and hexbytes |
questionable, but maybe ok.. this compiles def test() -> Bytes[10]:
x: Bytes[10] = x' 10 '
return x |
good idea, added here 24bb91d |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4406 +/- ##
===========================================
- Coverage 91.86% 44.91% -46.96%
===========================================
Files 119 119
Lines 16640 16677 +37
Branches 2801 2806 +5
===========================================
- Hits 15286 7490 -7796
- Misses 929 8623 +7694
- Partials 425 564 +139 ☔ View full report in Codecov by Sentry. |
this commit fixes parsing of hex strings. it leaves the locations unmodified as to minimize the changes to locations in the source code
What I did
Fix #4405
How I did it
How to verify it
Commit message
Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)
Description for the changelog
Cute Animal Picture