-
Notifications
You must be signed in to change notification settings - Fork 138
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
Introduce filter
in Fixed/Variable sized Array types
#2678
Conversation
filter
in VariableSizedArray type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some tests here to check that mutation in the array-filtering predicate function is properly prevented here.
@dsainati1 Didn't get it completely. Is it relevant also for non-resource arrays? I based the implementation on cadence/runtime/interpreter/value.go Line 17038 in 181924e
|
Ah good point, I missed that this was not implemented for resource arrays. That makes sense. |
Can't we still make this function available for fixed-sized arrays? The return type of the function would always be variable-sized. |
@SupunS Yeah, sure. Can be done. I'll update the PR tomorrow. |
filter
in VariableSizedArray typefilter
in Fixed/Variable sized Array types
Codecov Report
@@ Coverage Diff @@
## master #2678 +/- ##
==========================================
+ Coverage 78.57% 79.12% +0.55%
==========================================
Files 338 333 -5
Lines 78216 78306 +90
==========================================
+ Hits 61456 61962 +506
+ Misses 14474 14047 -427
- Partials 2286 2297 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@SupunS This is ready for your review now. |
@SupunS @turbolent Gentle ping for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Work towards #2605
Description
Introduce
filter
function for creating a copy of an Array value with its entries filtered via predicate.This function would be unavailable to resource arrays since resources cannot be copied
Will send docs PR post the merge.
master
branchFiles changed
in the Github PR explorer