-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Change findfirst and findlast to return cartesian indices with HasShape iterators #25655
Conversation
test/iterators.jl
Outdated
@@ -321,7 +321,7 @@ end | |||
@test Base.IteratorSize(product(1:2)) == Base.HasShape{1}() | |||
@test Base.IteratorSize(product(1:2, 1:2)) == Base.HasShape{2}() | |||
@test Base.IteratorSize(product(take(1:2, 1), take(1:2, 1))) == Base.HasShape{2}() | |||
@test Base.IteratorSize(product(take(1:2, 2))) == Base.HasShape{2}() | |||
@test Base.IteratorSize(product(take(1:2, 2))) == Base.HasShape{1}() |
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.
Should this change be moved to the first commit, or is it ok to just squash them?
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.
Ah, good catch. They could be squashed, but since the first one makes sense on its own, probably better keep them separate. I've moved the change to the first commit.
Needed to determine the shape of indices in a type-stable way.
…pe iterators This represents better the shape of the iterator, and makes generators over arrays consistent with their input array. Keep returning linear indices with HasShape{1} iterators for consistency with vectors.
Should this have a NEWS entry because it breaks |
See #25767. |
This represents better the shape of the iterator, and makes generators over arrays consistent with their input array. Keep returning linear indices with
HasShape{1}
iterators for consistency with vectors. See #10593. Part of #10593.The first commit is needed for this change, though it makes sense in isolation. It's extracted from #25356, where it received support from @timholy.