fix[lang]: use correct DataLocation for internal function args#4835
Open
frederikgramkortegaard wants to merge 3 commits intovyperlang:masterfrom
Open
fix[lang]: use correct DataLocation for internal function args#4835frederikgramkortegaard wants to merge 3 commits intovyperlang:masterfrom
frederikgramkortegaard wants to merge 3 commits intovyperlang:masterfrom
Conversation
_parse_args was hardcoding CALLDATA for all functions, but internal function arguments live in memory. Added visibility parameter to select the correct location. Fixes vyperlang#4754
85dbb74 to
a2b5188
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4835 +/- ##
=======================================
Coverage 92.91% 92.91%
=======================================
Files 156 156
Lines 21812 21815 +3
Branches 3902 3903 +1
=======================================
+ Hits 20267 20270 +3
Misses 1023 1023
Partials 522 522 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| funcdef: vy_ast.FunctionDef, is_interface: bool = False | ||
| funcdef: vy_ast.FunctionDef, | ||
| is_interface: bool = False, | ||
| visibility: FunctionVisibility = FunctionVisibility.EXTERNAL, |
Member
There was a problem hiding this comment.
it's ok to change the arg order here btw
Member
There was a problem hiding this comment.
@frederikgramkortegaard can you move visibility to be a positional arg, i'd like it to be required at the call site
charles-cooper
approved these changes
Feb 8, 2026
Member
charles-cooper
left a comment
There was a problem hiding this comment.
looks fine, please add a test for this
e7c62cb to
04cf22b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_parse_args was hardcoding CALLDATA for all functions, but internal function arguments live in memory. Added visibility parameter to select the correct location.
Fixes #4754
What I did
Fixed
_parse_argsto use the correctDataLocationwhen validating function argument types. Internal functions now correctly check againstMEMORYinstead ofCALLDATA.How I did it
Added a
visibilityparameter to_parse_args(defaults toEXTERNALto avoid changing parameter order). When visibility isINTERNALwe useDataLocation.MEMORYotherwise we usesDataLocation.CALLDATA.How to verify it
Before:
HashMap[uint256, uint256] is not instantiable in calldataAfter:
HashMap[uint256, uint256] is not instantiable in memoryCommit message
fix: use correct DataLocation for internal function args
Description for the changelog
Fixed incorrect error messages for internal function arguments - now correctly reports "memory" instead of "calldata"
Cute Animal Picture