Skip to content
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

Remove multidimensional indexing of tuples #20468

Merged
merged 1 commit into from
Feb 7, 2017
Merged

Conversation

ararslan
Copy link
Member

@ararslan ararslan commented Feb 6, 2017

Currently a method for tuples exists which permits multidimensional indexing (see #20453). The method merely splats the dimensions and ends up inadvertently calling itself recursively, as there's no more specific method for it to use. This PR simply removes the method and adds tests to ensure the behavior doesn't return.

Fixes #20453

@ararslan ararslan added the domain:collections Data structures holding multiple items, e.g. sets label Feb 6, 2017
@ararslan
Copy link
Member Author

ararslan commented Feb 6, 2017

It looks like the method was added in #16986. @pabloferz, do you know what in particular that method was for? I couldn't find any actual uses of it in the multidimensional code.

@pabloferz
Copy link
Contributor

do you know what in particular that method was for?

broadcast. The broadcast mechanism generates CartesianIndex for indexing the arguments of broadcast. I should have only defined getindex(t::Tuple, I::CartesianIndex{1}), but just copied the array code at the time. That's probably what should be done here instead.

Previously a method for tuples existed which permited multidimensional
indexing. However, the method merely splatted the dimensions and ended
up calling itself, infinitely recursing. This commit replaces the method
with one that permits the desired behavior for broadcast without
permitting things like (1,)[1,1].
@ararslan
Copy link
Member Author

ararslan commented Feb 6, 2017

Aha, I should have known! Thanks for your help. I've replaced the method with one for Cartesian indexing. It would be great if you could take a look, since you're more familiar with the broadcast code than I am.

Copy link
Contributor

@pabloferz pabloferz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for fixing this!

@pabloferz pabloferz merged commit 0900553 into master Feb 7, 2017
@ararslan ararslan deleted the aa/tuple-indexing branch February 7, 2017 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:collections Data structures holding multiple items, e.g. sets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants