Skip to content
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

show type information for invalid index error #27837

Merged
merged 1 commit into from
Jun 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
show type information for invalid index error
  • Loading branch information
fredrikekre committed Jun 28, 2018
commit 7fa96cd67e5ab75b4f06c4e48581c16efd64465f
7 changes: 4 additions & 3 deletions base/indices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,13 @@ indexing behaviors. This must return either an `Int` or an `AbstractArray` of
"""
to_index(i::Integer) = convert(Int,i)::Int
# TODO: Enable this new definition after the deprecations introduced in 0.7 are removed
# to_index(i::Bool) = throw(ArgumentError("invalid index: $i"))
# to_index(i::Bool) = throw(ArgumentError("invalid index: $i of type $(typeof(i))"))
to_index(I::AbstractArray{Bool}) = LogicalIndex(I)
to_index(I::AbstractArray) = I
to_index(I::AbstractArray{<:Union{AbstractArray, Colon}}) = throw(ArgumentError("invalid index: $I"))
to_index(I::AbstractArray{<:Union{AbstractArray, Colon}}) =
throw(ArgumentError("invalid index: $I of type $(typeof(I))"))
to_index(::Colon) = throw(ArgumentError("colons must be converted by to_indices(...)"))
to_index(i) = throw(ArgumentError("invalid index: $i"))
to_index(i) = throw(ArgumentError("invalid index: $i of type $(typeof(i))"))

# The general to_indices is mostly defined in multidimensional.jl, but this
# definition is required for bootstrap:
Expand Down