Skip to content

Commit 765c29c

Browse files
fix: fix inference of getindex(::ArrayPartition, ::Int)
1 parent 3543a1b commit 765c29c

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/array_partition.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ Base.@propagate_inbounds function Base.getindex(A::ArrayPartition, i::Int)
219219
return A.x[j][length(A.x[j]) + i]
220220
end
221221
end
222+
throw(BoundsError(A, i))
222223
end
223224

224225
"""

test/partitions_test.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using RecursiveArrayTools, Test, Statistics, ArrayInterface
22
A = (rand(5), rand(5))
33
p = ArrayPartition(A)
4+
@inferred p[1]
45
@test (p.x[1][1], p.x[2][1]) == (p[1], p[6])
56

67
p = ArrayPartition(A, Val{true})

0 commit comments

Comments
 (0)