Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 binary number literals to solidity #15046
Add binary number literals to solidity #15046
Changes from all commits
792a3bd
2591f34
5777738
6dbb9d2
f322ab3
c7046b7
fc7b148
3f40093
f5d8a86
cab76b8
2fc70c2
01e9ca3
3a109ff
8a2be35
dc878ed
75624b5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some syntax/semantic tests for literal arithmetic, i.e.
0b01 + 0b10
, etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask writing semantic tests like
is the right way? If it is, should I go for every binary / unary operators, including
+,-,*,/,%,^,%
? How should the test be complex?Also, can you recommend any existing syntax tests that we should add more, or any examples? I do not get the concrete idea for adding new syntax tests; compared to semantic test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please point some existing tests that tests literal arithmetic, like
0x01 + 0x10
or1 + 2
? I agree that adding tests for binary number literal is necessary because it is a new feature, but if those tests exists, referencing them would be helpful for me to add more tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above is fine; I doubt we have many such tests, since it's been a very long time since we've introduced a feature like this; you can take a look at
semanticTests/arithmetics
,semanticTests/exponentiation
, and probably some more, but as I said, what you have here should be enough.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added two tests at 7cdaa37.