-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
feat: new conversion rules #2694
feat: new conversion rules #2694
Conversation
a lot of the work is already done in the typechecker
This pull request introduces 3 alerts when merging 50af15e into aa8affb - view on LGTM.com new alerts:
|
This pull request introduces 11 alerts when merging 7e73219 into aa8affb - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging a9f8d99 into aa8affb - view on LGTM.com new alerts:
|
This pull request introduces 4 alerts when merging 238949a into aa8affb - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging e3a729f into aa8affb - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging fd6f333 into aa8affb - view on LGTM.com new alerts:
|
vyper/builtin_functions/convert.py
Outdated
def _input_types(*allowed_types): | ||
def decorator(f): | ||
@functools.wraps(f) | ||
def g(expr, arg, out_typ): |
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.
suggest better names, expr->convert_expr, arg -> to_convert or something
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.
out_type -> cast_type or convert_type
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.
I agree, g
is not a great name
Codecov Report
@@ Coverage Diff @@
## master #2694 +/- ##
==========================================
+ Coverage 86.43% 86.98% +0.55%
==========================================
Files 91 91
Lines 9883 9846 -37
Branches 2492 2469 -23
==========================================
+ Hits 8542 8565 +23
+ Misses 839 798 -41
+ Partials 502 483 -19
Continue to review full report at Codecov.
|
This pull request introduces 2 alerts when merging d4f1797 into cfe26e1 - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging c916f58 into cfe26e1 - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging 4ed8435 into cfe26e1 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 6838dd0 into cfe26e1 - view on LGTM.com new alerts:
|
This commit refactors and changes conversion semantics to be in line with VIP 2507. The main changes from existing behavior are: - fewer allowed conversions with address (eg. decimal/address unallowed) - decimals are bitcasted with bytes - fixes involving sign extension By generalizing the conversion rules to not use hardcoded integer/bytes types, this commit lays some groundwork for more integer/bytes types since we will not have to add a case for every single type. This commit is a first pass; the tests should be consolidated and refactored before release, and some cases involving conversion to bytes have not been added yet. Also, the logic should probably be cleaned up so that it is easier to validate/reason about.
vyper/builtin_functions/convert.py
Outdated
def _input_types(*allowed_types): | ||
def decorator(f): | ||
@functools.wraps(f) | ||
def g(expr, arg, out_typ): |
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.
I agree, g
is not a great name
What I did
fix #2507
Commit message
Description for the changelog
Cute Animal Picture