Skip to content

Commit

Permalink
fix indexing for infsteprange (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub authored Oct 17, 2022
1 parent 5a4acbf commit 0873436
Show file tree
Hide file tree
Showing 3 changed files with 5 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.7"
version = "0.12.8"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
1 change: 1 addition & 0 deletions src/infrange.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ function getindex(v::OneToInf{T}, i::Integer) where T
end
function getindex(v::InfStepRange{T}, i::Integer) where T
@boundscheck i > 0 || Base.throw_boundserror(v, i)
i == 1 && return convert(T, first(v))
convert(T, first(v) + (i - 1)*step(v))
end

Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ end

@test (1:∞)[Base.Slice(1:∞)] 1:
@test Base.Slice(1:∞)[2:∞] 2:

v = InfiniteArrays.InfStepRange(InfiniteCardinal{0}(), InfiniteCardinal{0}())
@test v[1] == v[2] == InfiniteCardinal{0}()
end
@testset "length" begin
@test length(.1:.1:∞) == ℵ₀
Expand Down

3 comments on commit 0873436

@jishnub
Copy link
Member Author

Choose a reason for hiding this comment

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

@dlfivefifty gentle bump for a tag

@dlfivefifty
Copy link
Member

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/70389

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.8 -m "<description of version>" 08734365328dc88429c6f1e04d22e10e77133b1e
git push origin v0.12.8

Please sign in to comment.