Skip to content

Commit

Permalink
Missing _rangestyle (#86)
Browse files Browse the repository at this point in the history
* Missing _rangestyle

* Update runtests.jl
  • Loading branch information
dlfivefifty authored Oct 9, 2021
1 parent 51f16f2 commit 3411f90
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "InfiniteArrays"
uuid = "4858937d-0d70-526a-a4dd-2d5cb5dd786c"
version = "0.12.2"
version = "0.12.3"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
2 changes: 2 additions & 0 deletions src/infrange.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ _rangestyle(::Ordered, ::ArithmeticWraps, a::T, step::S, len::InfiniteCardinal{0
InfStepRange{T,S}(a, step)
_rangestyle(::Ordered, ::ArithmeticUnknown, a::T, step::S, len::InfiniteCardinal{0}) where {T,S} =
InfStepRange{T,S}(a, step)
_rangestyle(::Any, ::Any, a::T, step::S, len::InfiniteCardinal{0}) where {T,S} =
InfStepRange{T,S}(a, step)
_range(a::T, st::T, ::Nothing, ::InfiniteCardinal{0}) where T<:Union{Float16,Float32,Float64} =
InfStepRange{T,T}(a, st)
_range(a::T, st::T, ::Nothing, ::InfiniteCardinal{0}) where T<:AbstractFloat =
Expand Down
11 changes: 11 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1029,4 +1029,15 @@ Base.getindex(::MyInfMatrix, k::Int, j::Int) = k+j
@test MyInfMatrix()[2:∞,3:∞][1:10,1:10] == MyInfMatrix()[2:11,3:12]
@test MyInfMatrix()[2:11,3:∞][1:10,1:10] == MyInfMatrix()[2:11,3:12]
@test MyInfMatrix()[2:∞,3:12][1:10,1:10] == MyInfMatrix()[2:11,3:12]
end

struct MyReal <: Real
x::Float64
end

Base.ArithmeticStyle(::Type{MyReal}) = Base.ArithmeticRounds()

@testset "non-float _range with ArithmeticRounds" begin
# this missing overloaded was triggered by ForwardDiff.Dual
@test range(MyReal(0.1); step=MyReal(0.2), length=ℵ₀) isa InfStepRange
end

2 comments on commit 3411f90

@dlfivefifty
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/46389

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.12.3 -m "<description of version>" 3411f90c931354dba0aa5128d8cd13eba70ff6b4
git push origin v0.12.3

Please sign in to comment.