-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Warning: This declaration shadows an existing declaration. #2391
Comments
Solidity 0.7.4 now properly diagnoses shadowing when it clashes with variables or functions that are only declared later on in the file. This leads to a massive number of warnings, since Contracts has sort of relied on this and used careful ordering to avoid warnings. A compilation of Contracts itself yields 250 lines of warnings. Pretty much every user of the library gets a few of these when using 0.7.4. |
I confirm the issue with solc 0.7.4
|
If anyone would like to provide a PR for this it would be really appreciated. I won't be able to tackle this until next week. |
As a follow up to the number of warnings this actually produces, I'd like to clarify there is only 14 warnings due to variable shadowing. In any case, we're working on this in #2396 and it will be released as soon as possible. |
* Fix unnamed return variable warning This commit fixes warnings thrown by the solc 0.7.4 compiler: "Warning: Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable." * Fix function state mutability warning This commit fixes warnings thrown by the solc 0.7.4 compiler: "Warning: Function state mutability can be restricted to pure" * Fix shadows an existing declaration warning This commit fixes warnings thrown by the solc 0.7.4 compiler: "Warning: This declaration shadows an existing declaration." 1. Arguments by default are not underscored. 2. If the name isn't available due to shadowing, use prefix underscore. 3. If prefix underscore isn't available due to shadowing, use suffix underscore.
Fixed by @zemse in #2396. Thank you! Released now in |
why my solc 0.8.15 still got the same error ? |
@0xKarl98 Open a new issue. |
There are lot of
Warning: This declaration shadows an existing declaration.
.Is there a way to silence these warnings.
I'm using solc 0.7.4
The text was updated successfully, but these errors were encountered: