diff --git a/base/multidimensional.jl b/base/multidimensional.jl index f793df068ec5a..314db226b63b7 100644 --- a/base/multidimensional.jl +++ b/base/multidimensional.jl @@ -1564,7 +1564,7 @@ end isassigned(a::AbstractArray, i::CartesianIndex) = isassigned(a, Tuple(i)...) function isassigned(A::AbstractArray, i::Union{Integer, CartesianIndex}...) - isa(i, Tuple{Vararg{Int}}) || return isassigned(A, CartesianIndex(i...)) + isa(i, Tuple{Vararg{Int}}) || return isassigned(A, CartesianIndex(to_indices(A, i))) @boundscheck checkbounds(Bool, A, i...) || return false S = IndexStyle(A) ninds = length(i) diff --git a/test/abstractarray.jl b/test/abstractarray.jl index 47a81bbbf5b66..29bc514bb1802 100644 --- a/test/abstractarray.jl +++ b/test/abstractarray.jl @@ -1854,3 +1854,9 @@ end # type stable [x;;] (https://github.com/JuliaLang/julia/issues/45952) f45952(x) = [x;;] @inferred f45952(1.0) + +@testset "isassigned with a Bool index" begin + A = zeros(2,2) + @test_throws "invalid index: true of type Bool" isassigned(A, 1, true) + @test_throws "invalid index: true of type Bool" isassigned(A, true) +end