-
Notifications
You must be signed in to change notification settings - Fork 228
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
Implement undefined variable detection and prettify warning messages #468
Merged
seanyoung
merged 1 commit into
hyperledger-solang:main
from
LucasSte:undefined-variable-detection
Aug 19, 2021
Merged
Implement undefined variable detection and prettify warning messages #468
seanyoung
merged 1 commit into
hyperledger-solang:main
from
LucasSte:undefined-variable-detection
Aug 19, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
seanyoung
requested changes
Aug 17, 2021
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.
Looks great so far!
cd69f74
to
cde7a8d
Compare
2054162
to
dbf1120
Compare
Signed-off-by: Lucas Steuernagel <lucas.tnagel@gmail.com>
bfd2f62
to
8e599f9
Compare
seanyoung
approved these changes
Aug 19, 2021
seanyoung
added a commit
to seanyoung/solang
that referenced
this pull request
Aug 27, 2021
Added - Added a strength reduce pass to eliminate 256/128 bit multiply, division, and modulo where possible. - Visual Studio Code extension can download the Solang binary from github releases, so the user is not required to download it themselves - The Solana target now has support for arrays and mapping in contract storage - The Solana target has support for the keccak256(), ripemd160(), and sha256() builtin hash functions. - The Solana target has support for the builtins this and block.timestamp. - Implement abi.encodePacked() for the ethereum abi encoder - The Solana target now compiles all contracts to a single `bundle.so` BPF program. - Any unused variables, events, or contract variables are now detected and warnings are given, thanks to [LucasSte](hyperledger-solang#429) - The `immutable` attribute on contract storage variables is now supported. - The `override` attribute on public contract storage variables is now supported. - The `unchecked {}` code block is now parsed and supported. Math overflow still is unsupported for types larger than 64 bit. - `assembly {}` blocks are now parsed and give a friendly error message. - Any variable use before it is given a value is now detected and results in a undefined variable diagnostic, thanks to [LucasSte](hyperledger-solang#468) Changed - Solang now uses LLVM 12.0, based on the [Solana LLVM tree](https://github.com/solana-labs/llvm-project/) Fixed - Fix a number of issues with parsing the uniswap v2 contracts - ewasm: staticcall() and delegatecall() cannot take value argument - Fixed array support in the ethereum abi encoder and decoder - Fixed issues in arithmetic on non-power-of-2 types (e.g. uint112) Signed-off-by: Sean Young <sean@mess.org>
seanyoung
added a commit
that referenced
this pull request
Aug 27, 2021
Added - Added a strength reduce pass to eliminate 256/128 bit multiply, division, and modulo where possible. - Visual Studio Code extension can download the Solang binary from github releases, so the user is not required to download it themselves - The Solana target now has support for arrays and mapping in contract storage - The Solana target has support for the keccak256(), ripemd160(), and sha256() builtin hash functions. - The Solana target has support for the builtins this and block.timestamp. - Implement abi.encodePacked() for the ethereum abi encoder - The Solana target now compiles all contracts to a single `bundle.so` BPF program. - Any unused variables, events, or contract variables are now detected and warnings are given, thanks to [LucasSte](#429) - The `immutable` attribute on contract storage variables is now supported. - The `override` attribute on public contract storage variables is now supported. - The `unchecked {}` code block is now parsed and supported. Math overflow still is unsupported for types larger than 64 bit. - `assembly {}` blocks are now parsed and give a friendly error message. - Any variable use before it is given a value is now detected and results in a undefined variable diagnostic, thanks to [LucasSte](#468) Changed - Solang now uses LLVM 12.0, based on the [Solana LLVM tree](https://github.com/solana-labs/llvm-project/) Fixed - Fix a number of issues with parsing the uniswap v2 contracts - ewasm: staticcall() and delegatecall() cannot take value argument - Fixed array support in the ethereum abi encoder and decoder - Fixed issues in arithmetic on non-power-of-2 types (e.g. uint112) Signed-off-by: Sean Young <sean@mess.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR implements undefined variable detection for variables in function scope, using the current reaching definitions implementation. A few points need further improvement:
Instr::AbiDecode
needs refactoring to make reaching definitions work properly with try-catch statements.In addition, the PR prettifies warnings and errors messages Solang prints to CLI. Here is an example of the new formatting:
This work is part of the Linux Foundation mentorship for the Hyperledge Solang compiler. For more information, please refer to the project plan.