Skip to content

Commit

Permalink
Add a defensive ambiguity-resolving method
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed May 18, 2020
1 parent fbe8af8 commit 93ed743
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ _getindex(::IndexStyle, A::AbstractArray, I...) =
error("getindex for $(typeof(A)) with types $(typeof(I)) is not supported")

## IndexLinear Scalar indexing: canonical method is one Int
_getindex(::IndexLinear, A::AbstractVector, i::Int) = (@_propagate_inbounds_meta; getindex(A, i)) # ambiguity resolution in case packages specialize this (to be avoided if at all possible, but see Interpolations.jl)
_getindex(::IndexLinear, A::AbstractArray, i::Int) = (@_propagate_inbounds_meta; getindex(A, i))
function _getindex(::IndexLinear, A::AbstractArray, I::Vararg{Int,M}) where M
@_inline_meta
Expand Down

0 comments on commit 93ed743

Please sign in to comment.