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

disallow changes to decimal precision #2479

Merged
merged 2 commits into from
Oct 7, 2021

Conversation

charles-cooper
Copy link
Member

otherwise, literals like (-2**127 - 0.001) will silently have digits
truncated.

What I did

How I did it

How to verify it

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@charles-cooper
Copy link
Member Author

we have a test for it

x: decimal = -170141183460469231731687303715884105728.0000000001
but apparently it hasn't been getting run

@codecov-commenter
Copy link

codecov-commenter commented Oct 6, 2021

Codecov Report

Merging #2479 (30709fd) into master (c763d96) will decrease coverage by 0.01%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2479      +/-   ##
==========================================
- Coverage   84.53%   84.52%   -0.02%     
==========================================
  Files          93       93              
  Lines        9223     9228       +5     
  Branches     2084     2085       +1     
==========================================
+ Hits         7797     7800       +3     
- Misses        938      939       +1     
- Partials      488      489       +1     
Impacted Files Coverage Δ
vyper/old_codegen/parser_utils.py 83.06% <71.42%> (-0.32%) ⬇️
vyper/exceptions.py 92.66% <100.00%> (+0.06%) ⬆️
vyper/old_codegen/expr.py 79.27% <100.00%> (-0.05%) ⬇️

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 c763d96...30709fd. Read the comment docs.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 7, 2021

This pull request introduces 1 alert when merging 3ba5932 into c763d96 - view on LGTM.com

new alerts:

  • 1 for Unused import

Copy link
Member

@fubuloubu fubuloubu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the unused import and g2g

it is already set correctly in parser_utils.py.

otherwise, literals like (-2**127 - 0.001) will silently have digits
truncated.
@charles-cooper charles-cooper changed the title increase precision of decimal disallow changes to decimal precision Oct 7, 2021
vyper/exceptions.py Outdated Show resolved Hide resolved
@fubuloubu fubuloubu merged commit f9a81a0 into vyperlang:master Oct 7, 2021
charles-cooper added a commit to charles-cooper/brownie that referenced this pull request Oct 24, 2021
vyperlang/vyper#2479 disabled changes to the
global decimal context to preserve compile-time constant semantics.
This commit changes use of the global getcontext to a local context. It
shouldn't change the behavior of the current code (since it didn't depend
on modifying the global context, just having a local Context with the
correct precision).
charles-cooper added a commit to charles-cooper/brownie that referenced this pull request Oct 27, 2021
vyperlang/vyper#2479 disabled changes to the
global decimal context to preserve compile-time constant semantics.
This commit changes use of the global getcontext to a local context. It
shouldn't change the behavior of the current code (since it didn't depend
on modifying the global context, just having a local Context with the
correct precision).
charles-cooper added a commit to charles-cooper/brownie that referenced this pull request Oct 27, 2021
vyperlang/vyper#2479 disabled changes to the
global decimal context to preserve compile-time constant semantics.
This commit changes use of the global getcontext to a local context. It
shouldn't change the behavior of the current code (since it didn't depend
on modifying the global context, just having a local Context with the
correct precision).
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.

None yet

3 participants