Skip to content

Implement Base.checkindex for InvertedIndex #21

@nalimilan

Description

@nalimilan

Is there any reason why checkindex(::Type{Bool}, ..., ::InvertedIndex) isn't implemented? CategoricalArrays currently doesn't work with Not because of this (JuliaData/CategoricalArrays.jl#296):

julia> using CategoricalArrays, InvertedIndices

julia> categorical(1:10)[Not([3])]
ERROR: ArgumentError: unable to check bounds for indices of type InvertedIndex{Array{Int64,1}}
Stacktrace:
 [1] checkindex(::Type{Bool}, ::Base.OneTo{Int64}, ::InvertedIndex{Array{Int64,1}}) at ./abstractarray.jl:561
 [2] checkbounds at ./abstractarray.jl:491 [inlined]
 [3] checkbounds at ./abstractarray.jl:506 [inlined]
 [4] getindex(::CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}}, ::InvertedIndex{Array{Int64,1}}) at /home/milan/.julia/dev/CategoricalArrays/src/array.jl:735
 [5] top-level scope at REPL[11]:1
 [6] run_repl(::REPL.AbstractREPL, ::Any) at /builddir/build/BUILD/julia/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions