Skip to content

fix-#2183: Incorrect output while passing multi-dimensional array as argument#2184

Merged
fubuloubu merged 2 commits into
vyperlang:masterfrom
saikat041:fix-#2183
Oct 8, 2020
Merged

fix-#2183: Incorrect output while passing multi-dimensional array as argument#2184
fubuloubu merged 2 commits into
vyperlang:masterfrom
saikat041:fix-#2183

Conversation

@saikat041

Copy link
Copy Markdown
Contributor

What I did

Fixed: #2183

How I did it

In this line it is assumed that size of each subtype of a array/struct is 32, which is wrong:

staticarray_offset += 32 * (count - 1)

So I replaced the above line with this.

staticarray_offset += 32 * (get_size_of_type(typ) - 1)

And since the variable count is not needed anymore we can avoid its calculation here:

if isinstance(typ, ListType):

@codecov-io

codecov-io commented Oct 8, 2020

Copy link
Copy Markdown

Codecov Report

Merging #2184 into master will decrease coverage by 0.09%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2184      +/-   ##
==========================================
- Coverage   85.32%   85.22%   -0.10%     
==========================================
  Files          83       79       -4     
  Lines        8403     8219     -184     
  Branches     2032     2005      -27     
==========================================
- Hits         7170     7005     -165     
+ Misses        731      714      -17     
+ Partials      502      500       -2     
Impacted Files Coverage Δ
vyper/parser/parser_utils.py 80.49% <100.00%> (-0.16%) ⬇️
vyper/typing.py
vyper/__main__.py
vyper/opcodes.py
vyper/exceptions.py

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 5115867...4a9656f. Read the comment docs.

@iamdefinitelyahuman iamdefinitelyahuman 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 catch!

@fubuloubu fubuloubu merged commit 0be02b7 into vyperlang:master Oct 8, 2020
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.

Incorrect output while passing multi-dimensional array as argument

4 participants