Skip to content

Bugfix: returning tuples from private functions#1968

Merged
fubuloubu merged 2 commits into
vyperlang:masterfrom
iamdefinitelyahuman:fix-tuple-returns
May 13, 2020
Merged

Bugfix: returning tuples from private functions#1968
fubuloubu merged 2 commits into
vyperlang:masterfrom
iamdefinitelyahuman:fix-tuple-returns

Conversation

@iamdefinitelyahuman

Copy link
Copy Markdown
Contributor

What I did

Fix a memory offset issue when returning tuple types from a private function.

Fixes #1847

How I did it

In parser/self_call.py:

  • update the offset by the actual size of the value rather than 32
  • ensure there is a new mstore for each value of an array inside a tuple.

How to verify it

Run tests. I added some new cases.

Cute Animal Picture

image

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #1968 into master will decrease coverage by 0.41%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1968      +/-   ##
==========================================
- Coverage   86.99%   86.57%   -0.42%     
==========================================
  Files          58       58              
  Lines        6629     6631       +2     
  Branches     1673     1674       +1     
==========================================
- Hits         5767     5741      -26     
- Misses        546      569      +23     
- Partials      316      321       +5     
Impacted Files Coverage Δ
vyper/parser/self_call.py 94.44% <100.00%> (+0.10%) ⬆️
vyper/functions/functions.py 87.17% <0.00%> (-5.10%) ⬇️
vyper/ast/nodes.py 92.85% <0.00%> (-1.74%) ⬇️
vyper/parser/expr.py 86.98% <0.00%> (+0.43%) ⬆️
vyper/codegen/abi.py 66.79% <0.00%> (+3.39%) ⬆️

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 7efcebd...e5533cc. Read the comment docs.

@fubuloubu fubuloubu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good set of tests here, I would like to see more, but this solves the bug for now.

Comment thread tests/parser/features/decorators/test_private.py Outdated
@fubuloubu fubuloubu merged commit e4ae6c0 into vyperlang:master May 13, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the fix-tuple-returns branch May 13, 2020 17:35
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.

Malformed data when passing a tuple or struct that contains an array

3 participants