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 {string|literal|number} to solidity and yul #15003
Conversation
Thank you for your contribution to the Solidity compiler! A team member will follow up shortly. If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother. If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix. |
e975f85
to
42f5cb9
Compare
42f5cb9
to
adf1f9a
Compare
Hey @pcw109550! Thank you for your contribution. We reviewed the PR and had a few inputs. It is generally not a common practice to work on closed issues. If you see an issue that you would like to work on in the future (especially closed ones), it is best to discuss with the team on matrix (I noticed that you joined recently) or join our language design calls prior to getting started to avoid spending time and effort on PRs that might need certain considerations before they can be accepted. That being said, we are unable to accept the PR in its current state due to the following:
Feel free to reach out to the team through the channels mentioned earlier to take this forward. :) |
@mehtavishwa30 Thanks for your input. Will first remove the |
@mehtavishwa30 Can you reopen this #14546 and remove |
Feature Description
Added binary {string|literal|number} to solidity and yul. Below works.
Syntax rules referred from hex string/literal/numbers. Please check ANTLR rules and docs for exact behavior. May subject to change!
Tests
Mirrored all hex related tests, and added binary literal related test if necessary. Please suggest if i missed anything.
Design
I manually implemented parsing binary strings to
u256
. Currently boost's multi precision lib, which is the dependency for solidity does not support binary parsing. Solidity internally usesu256
type, so I parsed manually.New Errors
5146_error
and5409_error
are introducedTODOs
There is a single TODO left at
libsolidity/AST/Types.cpp
:When control flow reaches TODO, we do not know
m_value
originated from hex string, string, or bin string. I just left as is. If this is okay, will remove TODO.