Skip to content

Commit

Permalink
Merge pull request #265 from jonniedie/another-lazy-array-thing
Browse files Browse the repository at this point in the history
Make `haskey` work for `LazyArray`
  • Loading branch information
jonniediegelman authored Jul 26, 2024
2 parents 664eb73 + 4fdfe36 commit f5574a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ComponentArrays"
uuid = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
authors = ["Jonnie Diegelman <[email protected]>"]
version = "0.15.15"
version = "0.15.16"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Expand Down
2 changes: 2 additions & 0 deletions src/lazyarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Base.propertynames(a::LazyArray) = propertynames(first(a))

Base.keys(a::LazyArray) = Base.OneTo(length(a))

Base.haskey(a::LazyArray, i::Integer) = i in keys(a)

Base.iterate(a::LazyArray) = iterate(getfield(a, :gen))
Base.iterate(a::LazyArray, state...) = iterate(getfield(a, :gen), state...)

Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ end
@test propertynames(ca2) == (:a, :b, :c) # ComponentArray
@test propertynames(ca2.b) == (:a, :b) # LazyArray

@test haskey(ca2, :a) # ComponentArray
@test haskey(ca2.b, 1) # LazyArray

@test keys(ca2) == (:a, :b, :c)
@test keys(ca2.b) == Base.OneTo(2)
end
Expand Down

2 comments on commit f5574a5

@jonniediegelman
Copy link
Collaborator 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/111856

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

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.15.16 -m "<description of version>" f5574a59dc201366cb2943c8101f8f49f212a2b1
git push origin v0.15.16

Please sign in to comment.