Skip to content

Fix default params#2077

Merged
fubuloubu merged 2 commits into
vyperlang:masterfrom
iamdefinitelyahuman:fix-default-params
Jul 1, 2020
Merged

Fix default params#2077
fubuloubu merged 2 commits into
vyperlang:masterfrom
iamdefinitelyahuman:fix-default-params

Conversation

@iamdefinitelyahuman

Copy link
Copy Markdown
Contributor

What I did

Properly handle default arguments with a size > 1 word. Fixes #1987

How I did it

In vyper/parser/function_definitions/parse_external_function.py::parse_external_function, use get_size_of_type to determine the size in memory for each default argument.

How to verify it

Run the tests. I added some cases based on the example in the issue. I also verified the behavior for internal functions.

Cute Animal Picture

image

@codecov-commenter

codecov-commenter commented Jul 1, 2020

Copy link
Copy Markdown

Codecov Report

Merging #2077 into master will decrease coverage by 0.92%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2077      +/-   ##
==========================================
- Coverage   85.04%   84.12%   -0.93%     
==========================================
  Files          83       83              
  Lines        8239     8240       +1     
  Branches     1985     1985              
==========================================
- Hits         7007     6932      -75     
- Misses        735      811      +76     
  Partials      497      497              
Impacted Files Coverage Δ
...er/function_definitions/parse_external_function.py 95.78% <100.00%> (+0.04%) ⬆️
vyper/context/types/value/numeric.py 78.04% <0.00%> (-6.10%) ⬇️
vyper/functions/functions.py 84.37% <0.00%> (-5.35%) ⬇️
vyper/parser/expr.py 71.66% <0.00%> (-5.00%) ⬇️
vyper/ast/nodes.py 92.72% <0.00%> (-1.62%) ⬇️
...er/function_definitions/parse_internal_function.py 98.01% <0.00%> (+0.99%) ⬆️

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 e0b7c70...41bcd81. Read the comment docs.

@fubuloubu fubuloubu merged commit 978f830 into vyperlang:master Jul 1, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the fix-default-params branch July 4, 2020 14:54
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.

Arrays as default arguments do not properly copy to memory

3 participants