-
Notifications
You must be signed in to change notification settings - Fork 40
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
Base.getindex(x::AbstractArray{T,N}, mask::Trues{N, NTuple{N,Base.OneTo{Int}}})
is downstream chaos
#162
Comments
This is a common case of a bad overload that causes problems. Perhaps for now we change it to only |
I think specializing on a few might work. |
When specializing on the indices rather than the array, it's better to specialize Lines 26 to 54 in eb8df92
and replacing them with |
@timholy I don't see how that could work in this case as we need to do something special with |
The `getindex` and `setindex!` methods for `Trues` are limited while also risking ambiguities. This replaces those definitions with a specialization for `to_indices` that avoids such problems. Closes #162
Tell that to CI 😄 (see #163) |
The `getindex` and `setindex!` methods for `Trues` are limited while also risking ambiguities. This replaces those definitions with a specialization for `to_indices` that avoids such problems. Closes #162
The `getindex` and `setindex!` methods for `Trues` are limited while also risking ambiguities. This replaces those definitions with a specialization for `to_indices` that avoids such problems. Closes #162
The `getindex` and `setindex!` methods for `Trues` are limited while also risking ambiguities. This replaces those definitions with a specialization for `to_indices` that avoids such problems. Closes #162
Found in the ambiguity detection in SciMLBase after a FillArrays.jl dependency was added:
https://github.com/SciML/RecursiveArrayTools.jl/runs/3752855248#step:6:202
The issue stems from
Base.getindex(x::AbstractArray{T,N}, mask::Trues{N, NTuple{N,Base.OneTo{Int}}})
types of definitions. The abstract array interface is defined as https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-array . This has definitionsgetindex(A, I...)
andsetindex!(A, X, I...)
specific to the arrayA
, but possibly non-specific to the typeI
. To handle some ambiguities we distinguish over a decently sized set:https://github.com/SciML/SciMLBase.jl/blob/master/src/solutions/solution_interface.jl#L31-L32
but adding FillArrays to the set still fails:
SciML/SciMLBase.jl#105
I think downstream packages defining any overloads of the form
Base.getindex(x::AbstractArray{T,N}, I::T)
whereT
is the new package thing will cause ambiguity issues and require all downstream array types to define the intersection methodBase.getindex(x::A, I::T)
, which means the only way it can be handled correctly is for type packageT
to be a dependency of all downstream array packagesA
(😱). To me that doesn't sound like a tenable solution.On top of that, I would presume that this definition, since it introduces ambiguities into all of these downstream "open indexing" definitions, it's also invalidating a ton of downstream
getindex
andsetindex!
operations as well. So it's likely not just an issue causing ambiguity errors but also hitting compile times.Maybe @timholy or @mbauman have an opinion on whether these overloads are okay. I would think the right thing would be to remove them.
The text was updated successfully, but these errors were encountered: