-
-
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
make broadcast treat all type arguments as scalars (fix DataArrays.jl#229) #19922
Conversation
@@ -25,13 +25,14 @@ function broadcast!{T,S,N}(::typeof(identity), x::AbstractArray{T,N}, y::Abstrac | |||
end | |||
|
|||
# logic for deciding the resulting container type | |||
containertype(x) = containertype(typeof(x)) | |||
containertype(x) = _containertype(typeof(x)) | |||
containertype(::Type) = Any |
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.
For clarity, this should perhaps be reordered so that all containertype
methods are together, after all the _containertype
methods.
It seems to me that the containertype(::Type) = Any
method is redundant and can be removed, because _containertype(DataType)
will already return Any
.
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.
Good call (and incorporated) on both counts. Thanks!
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.
We will need to inform packages about this change. I found these two uses:
For |
I'll handle ImageFiltering. |
Thanks all! |
Base.Broadcast.broadcast_containertype
is incorrect for::Type{T}
arguments to upstreambroadcast
whereT <: Union{Tuple, Ref, AbstractArray, Nullable}
, e.g.Base.Broadcast.broadcast_containertype(AbstractArray)
yieldsArray
rather thanAny
. That incorrect return causes, e.g.,This pull request addresses the above issue. Thanks to @ararslan for catching this issue in JuliaStats/DataArrays.jl#229!