Skip to content

Commit

Permalink
fix: fix inference of getindex(::ArrayPartition, ::Int)
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Feb 13, 2024
1 parent 3543a1b commit 765c29c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/array_partition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ Base.@propagate_inbounds function Base.getindex(A::ArrayPartition, i::Int)
return A.x[j][length(A.x[j]) + i]
end
end
throw(BoundsError(A, i))

Check warning on line 222 in src/array_partition.jl

View check run for this annotation

Codecov / codecov/patch

src/array_partition.jl#L222

Added line #L222 was not covered by tests
end

"""
Expand Down
1 change: 1 addition & 0 deletions test/partitions_test.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using RecursiveArrayTools, Test, Statistics, ArrayInterface
A = (rand(5), rand(5))
p = ArrayPartition(A)
@inferred p[1]
@test (p.x[1][1], p.x[2][1]) == (p[1], p[6])

p = ArrayPartition(A, Val{true})
Expand Down

0 comments on commit 765c29c

Please sign in to comment.