You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found this BoundsError trying to index an ASCIIString using a BitArray{1}:
julia> a = "ABC"
"ABC"
julia> b = [1,2,3].!=2
3-element BitArray{1}:
true
false
true
julia> a[b]
ERROR: BoundsError: attempt to access 3-element Array{UInt8,1}:
0x41
0x42
0x43
at index [0]
in anonymous at strings/basic.jl:43
in sprint at ./iostream.jl:206
in getindex at strings/basic.jl:42
julia> @which a[b]
getindex(s::AbstractString, v::AbstractArray{T,1}) at strings/basic.jl:42
KristofferC
changed the title
BoundsError when ASCIIString is indexed by an BitArray{1}
BoundsError when String is indexed by an BitArray{1}
Jan 26, 2017
Actually, no: now a[[true, false, true]] gives the same error, which at least is consistent. I'm not persuaded we need logical indexing of strings either, so what we could do is restrict the signature of getindex to ::AbstractVector{<:Integer} to make it a MethodError.
I found this
BoundsError
trying to index anASCIIString
using aBitArray{1}
:...but using a
Vector{Bool}
is fine:The text was updated successfully, but these errors were encountered: