Skip to content
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

Remove Excessive Scoping Rules on Local Variables #2166

Merged
merged 6 commits into from
Sep 27, 2020

Conversation

fubuloubu
Copy link
Member

fixes: #2127

Description for the changelog

No longer throws when a local variable has the same name as a global, due to the namespacing by self.

Cute Animal Picture

hooray

@codecov-commenter
Copy link

codecov-commenter commented Sep 27, 2020

Codecov Report

Merging #2166 into master will increase coverage by 0.95%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2166      +/-   ##
==========================================
+ Coverage   84.26%   85.22%   +0.95%     
==========================================
  Files          83       83              
  Lines        8337     8330       -7     
  Branches     2012     2009       -3     
==========================================
+ Hits         7025     7099      +74     
+ Misses        809      731      -78     
+ Partials      503      500       -3     
Impacted Files Coverage Δ
vyper/context/validation/local.py 88.23% <100.00%> (-0.15%) ⬇️
vyper/parser/context.py 93.25% <100.00%> (+2.04%) ⬆️
vyper/parser/global_context.py 77.77% <100.00%> (+0.81%) ⬆️
vyper/ast/nodes.py 93.84% <0.00%> (+1.53%) ⬆️
vyper/parser/expr.py 76.76% <0.00%> (+4.97%) ⬆️
vyper/functions/functions.py 89.71% <0.00%> (+5.34%) ⬆️
vyper/context/types/value/numeric.py 84.14% <0.00%> (+6.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 958a183...d459388. Read the comment docs.

@isavelli
Copy link

Here https://vyper.readthedocs.io/en/latest/scoping-and-declarations.html?highlight=shadow#name-shadowing
it still says:

It is not permitted for a memory or calldata variable to shadow the name of a storage variable.

I guess the reference to calldata should be removed given this merge?

@fubuloubu
Copy link
Member Author

Here https://vyper.readthedocs.io/en/latest/scoping-and-declarations.html?highlight=shadow#name-shadowing it still says:

It is not permitted for a memory or calldata variable to shadow the name of a storage variable.

I guess the reference to calldata should be removed given this merge?

Yes! Can you submit a PR please?

@isavelli
Copy link

No idea how to do :) Also, about the return statement https://vyper.readthedocs.io/en/latest/statements.html?highlight=return#return, the guide states that all functions must end with it, but the compiler seems fine if no return is provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variable Scoping Rules are overly aggressive wrt State Variables
4 participants