diff --git a/base/multidimensional.jl b/base/multidimensional.jl index 3b4cd27c82dce7..8104cddb343873 100644 --- a/base/multidimensional.jl +++ b/base/multidimensional.jl @@ -274,11 +274,6 @@ module IteratorsMD indices = map(r->convert(OrdinalRangeInt, r), inds) CartesianIndices{N, typeof(indices)}(indices) end - # specialized method in case conversion to an OrdinalRange is not defined for the indices (see issue #40035) - function CartesianIndices(inds::NTuple{N,AbstractUnitRange{<:Integer}}) where {N} - indices = map(r->convert(AbstractUnitRange{Int}, r), inds) - CartesianIndices{N, typeof(indices)}(indices) - end CartesianIndices(index::CartesianIndex) = CartesianIndices(index.I) CartesianIndices(inds::NTuple{N,Union{<:Integer,OrdinalRange{<:Integer}}}) where {N} = diff --git a/base/range.jl b/base/range.jl index 9207949090d1d5..19abd610ad48ba 100644 --- a/base/range.jl +++ b/base/range.jl @@ -1187,9 +1187,7 @@ AbstractUnitRange{T}(r::UnitRange) where {T} = UnitRange{T}(r) AbstractUnitRange{T}(r::OneTo) where {T} = OneTo{T}(r) OrdinalRange{T1, T2}(r::StepRange) where {T1, T2<: Integer} = StepRange{T1, T2}(r) -OrdinalRange{T1, T2}(r::AbstractUnitRange{T1}) where {T1, T2<:Integer} = r -OrdinalRange{T1, T2}(r::UnitRange) where {T1, T2<:Integer} = UnitRange{T1}(r) -OrdinalRange{T1, T2}(r::OneTo) where {T1, T2<:Integer} = OneTo{T1}(r) +OrdinalRange{T, T}(r::AbstractUnitRange) where {T<:Integer} = AbstractUnitRange{T}(r) promote_rule(::Type{StepRange{T1a,T1b}}, ::Type{StepRange{T2a,T2b}}) where {T1a,T1b,T2a,T2b} = el_same(promote_type(T1a,T2a),