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

Fix broadcast_indices #22130

Merged
merged 1 commit into from
Jun 1, 2017
Merged

Fix broadcast_indices #22130

merged 1 commit into from
Jun 1, 2017

Conversation

nalimilan
Copy link
Member

This fixes a regression introduced in 4f1b479. broadcast_indices() needs to
be overloaded by packages for custom types, so it cannot be hidden under
_broadcast_indices(). Also, ::Type is incorrect since the method only applies
to scalars.

Make the tests more complex to be closer to actual implementations in packages
so that regressions like this will be noticed in the future.

Fixes a bug in DataArrays: JuliaStats/DataArrays.jl#259 (comment)

This fixes a regression introduced in 4f1b479. broadcast_indices() needs to
be overloaded by packages for custom types, so it cannot be hidden under
_broadcast_indices(). Also, ::Type is incorrect since the method only applies
to scalars.

Make the tests more complex to be closer to actual implementations in packages
so that regressions like this will be noticed in the future.
@nalimilan
Copy link
Member Author

I just realized we already have _containertype which starts with an underscore and yet needs to be overridden by packages. It's really weird that non-exported, underscored functions would be part of the public API... Cf. design discussion at #20740.

@andyferris
Copy link
Member

Yes, underscored and not exported usually means the exact opposite of public API.

@ararslan ararslan added kind:bugfix This change fixes an existing bug domain:broadcast Applying a function over a collection labels May 30, 2017
@KristofferC
Copy link
Sponsor Member

Good to go?

Copy link
Member

@Sacha0 Sacha0 left a comment

Choose a reason for hiding this comment

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

lgtm! :)

@KristofferC KristofferC merged commit fb81c34 into master Jun 1, 2017
@nalimilan nalimilan deleted the nl/broadcast_indices branch June 1, 2017 21:06
@nalimilan
Copy link
Member Author

Thanks. It would still be interesting to have @vtjnash double-check this, in case we missed something.

@KristofferC
Copy link
Sponsor Member

Sorry, I missed the review request.

@nalimilan
Copy link
Member Author

No worries, four people considered it was a reasonable change, it passed the tests, and it fixes DataArrays tests. So the burden of the proof is on Jameson! ;-)

@vtjnash
Copy link
Sponsor Member

vtjnash commented Jun 1, 2017

it passed the tests, and it fixes DataArrays tests

you might need better tests... :P (yes, I realize this is also my fault for not adding a test when I fixed this code)

This PR broke cases like the following:

convert.(Nullable, [1, 2])
convert.(Any, [1, 2])

(causes them to compute the wrong size, shape, and type)

@vtjnash vtjnash restored the nl/broadcast_indices branch June 1, 2017 22:06
@vtjnash vtjnash deleted the nl/broadcast_indices branch June 1, 2017 22:06
vtjnash added a commit that referenced this pull request Jun 1, 2017
This reverts commit fb81c34.
And adds a test for the bug this causes.
vtjnash added a commit that referenced this pull request Jun 2, 2017
This reverts commit fb81c34.
And adds a test for the bug this causes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:broadcast Applying a function over a collection kind:bugfix This change fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants