add resize!, keepat!, pop!, popfist!, popat!#3047
Merged
Conversation
nalimilan
reviewed
May 8, 2022
This was referenced May 24, 2022
Member
Author
|
@nalimilan - this PR is ready for review. Thank you! |
nalimilan
reviewed
Jun 4, 2022
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
nalimilan
reviewed
Jun 4, 2022
bkamins
commented
Jun 5, 2022
nalimilan
approved these changes
Jun 5, 2022
| throw(ArgumentError("invalid index of type Bool")) | ||
| end | ||
|
|
||
| if !(eltype(inds) <: Integer || all(x -> x isa Integer, inds)) |
Member
There was a problem hiding this comment.
Same here?
Suggested change
| if !(eltype(inds) <: Integer || all(x -> x isa Integer, inds)) | |
| # this is required because of https://github.com/JuliaData/InvertedIndices.jl/issues/31 | |
| if !(eltype(inds) <: Integer || all(x -> x isa Integer, inds)) |
Member
Author
There was a problem hiding this comment.
No, here it is "just required". Here we know that inds is AbstractVector so it is not connected with Not. We just need to make sure all elements are Integer, as otherwise in line 826 in general user could get a weird error that <= is not defined for values passed.
I know it adds some performance overhead, but this method anyway is not type stable, so I think it is OK to add this check.
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
Member
Author
|
Thank you! |
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.
Partially implement changes requested in #2936.
@nalimilan - if you agree with the proposed changes (especially
deleteat!- I think, given that the operation is expensive anyway, we can afford sorting and de-duplicating incorrect input instead of having an undefined behavior in this case) I will add tests.