-
-
Notifications
You must be signed in to change notification settings - Fork 863
fix[lang]!: forbid calling __default__
#4371
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
fix[lang]!: forbid calling __default__
#4371
Conversation
vyper/semantics/types/module.py
Outdated
@@ -19,7 +19,7 @@ | |||
) | |||
from vyper.semantics.data_locations import DataLocation | |||
from vyper.semantics.types.base import TYPE_T, VyperType, is_type_t | |||
from vyper.semantics.types.function import ContractFunctionT | |||
from vyper.semantics.types.function import ContractFunctionT, MemberFunctionT |
Check failure
Code scanning / CodeQL
Module-level cyclic import Error
vyper.semantics.types.function
vyper.semantics.types.module
definition
import
'ContractFunctionT' may not be defined if module
vyper.semantics.types.function
vyper.semantics.types.module
definition
import
vyper/semantics/types/module.py
Outdated
@@ -19,7 +19,7 @@ | |||
) | |||
from vyper.semantics.data_locations import DataLocation | |||
from vyper.semantics.types.base import TYPE_T, VyperType, is_type_t | |||
from vyper.semantics.types.function import ContractFunctionT | |||
from vyper.semantics.types.function import ContractFunctionT, MemberFunctionT |
Check failure
Code scanning / CodeQL
Module-level cyclic import Error
vyper.semantics.types.function
vyper.semantics.types.module
definition
import
'MemberFunctionT' may not be defined if module
vyper.semantics.types.function
vyper.semantics.types.module
definition
import
we disallow
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4371 +/- ##
=======================================
Coverage 92.36% 92.36%
=======================================
Files 123 123
Lines 17527 17531 +4
Branches 2958 2959 +1
=======================================
+ Hits 16189 16193 +4
Misses 934 934
Partials 404 404 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@external | ||
def bar(): | ||
foo:int128 = 0 | ||
foo = staticcall lib1.__at__(self).__default__() |
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.
maybe we should also test the interface
variant:
@external
def bar():
foo:int128 = 0
foo = staticcall lib1.__interface__(self).__default__()
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.
Co-authored-by: Charles Cooper <cooper.charles.m@gmail.com>
19c0d14
to
13e7421
Compare
lgtm. @cyberthirst anything else you want to see? |
: forbid calling
__default__`
: forbid calling
__default__`__default__
What I did
Forbid calling
__default__
bystaticcall
andextcall
. Depends on #4090.Edit: Added dependency on the PR.
How I did it
In
validate
functions check the attribute name if present.How to verify it
Commit message
Description for the changelog
Cute Animal Picture