-
Notifications
You must be signed in to change notification settings - Fork 140
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
trying to add indexOf to array #1352
Conversation
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, looks good! Maybe rename, and please also add interpreter tests
Codecov Report
@@ Coverage Diff @@
## master #1352 +/- ##
==========================================
- Coverage 75.81% 72.65% -3.17%
==========================================
Files 279 288 +9
Lines 38780 39301 +521
==========================================
- Hits 29402 28555 -847
- Misses 8016 9257 +1241
- Partials 1362 1489 +127
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
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.
@bjartek Thank you for updating and adding more tests. There are some (minor) whitespace issues and it would be great if you could add one more checker test case for non-equatable values, then it should be good to go!
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
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.
Looks great, nice work! 👏
@SupunS Could you please also have a look?
func TestCheckArrayIndexOfNonEquatableValueArray(t *testing.T) { | ||
|
||
t.Parallel() | ||
|
||
_, err := ParseAndCheck(t, ` | ||
fun test(): Int? { | ||
let x = [[1, 2], [3]] | ||
return x.firstIndex(of: [3]) | ||
} | ||
`) | ||
|
||
errs := ExpectCheckerErrors(t, err, 1) | ||
assert.IsType(t, &sema.NotEquatableTypeError{}, errs[0]) | ||
} |
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.
👌
@SupunS @dsainati1 when you get a change, could you please have a second look? Thank you! |
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.
Looks good! 🎉
Thank you for the patient on the long delay for the review 🙏
Co-authored-by: Supun Setunga <[email protected]>
Closes #1276
Description
If you want to remove an element from a cadence array right now you have to use loops in cadence. This is inneficient.
This PR implements the
indexOf
method that in combination with remove can do that.master
branchFiles changed
in the Github PR explorer