diff --git a/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl b/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl index 5f23a7f351..57e9420d88 100644 --- a/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl +++ b/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl @@ -55,7 +55,7 @@ end # error with a conversion method in Base. using BlockArrays: BlockSlice function Base.UnitRange{T}( - a::BlockSlice{<:Any,<:LabelledInteger{T},<:GradedUnitRange{<:LabelledInteger{T}}} + a::BlockSlice{<:Any,<:LabelledInteger{T},<:AbstractUnitRange{<:LabelledInteger{T}}} ) where {T<:Integer} return UnitRange{T}(a.indices) end diff --git a/NDTensors/src/lib/GradedAxes/src/unitrangedual.jl b/NDTensors/src/lib/GradedAxes/src/unitrangedual.jl index 8b66e33850..1ef1c62a51 100644 --- a/NDTensors/src/lib/GradedAxes/src/unitrangedual.jl +++ b/NDTensors/src/lib/GradedAxes/src/unitrangedual.jl @@ -108,3 +108,12 @@ function Base.OrdinalRange{Int,Int}( # return Int.(r) return unlabel(nondual(r)) end + +# This is only needed in certain Julia versions below 1.10 +# (for example Julia 1.6). +# TODO: Delete this once we drop Julia 1.6 support. +# The type constraint `T<:Integer` is needed to avoid an ambiguity +# error with a conversion method in Base. +function Base.UnitRange{T}(a::UnitRangeDual{<:LabelledInteger{T}}) where {T<:Integer} + return UnitRange(nondual(a)) +end