Skip to content

Commit

Permalink
Merge pull request #352 from AayushSabharwal/as/arraypartition-inference
Browse files Browse the repository at this point in the history
fix: fix inference of `getindex(::ArrayPartition, ::Int)`
  • Loading branch information
ChrisRackauckas authored Feb 13, 2024
2 parents cfc9bca + 765c29c commit 88f1abb
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))
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 88f1abb

Please sign in to comment.