Skip to content

Commit

Permalink
Another fix for Julia 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Jul 1, 2024
1 parent da5abfa commit a38ecdb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions NDTensors/src/lib/GradedAxes/src/unitrangedual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a38ecdb

Please sign in to comment.