Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/blocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
```
"""
blocksizes(A::AbstractArray) = BlockSizes(A)
blocksizes(A::AbstractArray, d::Integer) = blocklengths(axes(A, d))
@inline blocksizes(A::AbstractArray, d::Integer) = blocklengths(axes(A, d))

Check warning on line 128 in src/blocks.jl

View check run for this annotation

Codecov / codecov/patch

src/blocks.jl#L128

Added line #L128 was not covered by tests

struct BlockSizes{T,N,A<:AbstractArray{<:Any,N}} <: AbstractArray{T,N}
array::A
Expand Down
8 changes: 8 additions & 0 deletions test/test_blocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ end
@test blocksizes(A, 1) == [2, 3]
@test blocksizes(A, 2) == [3, 1]
end

@testset "Inference: issue #425" begin
x = BlockedArray(rand(4, 4), [2, 2], [2, 2])
bs1 = @inferred (x -> blocksizes(x, 1))(x)
@test bs1 == [2,2]
bs4 = @inferred (x -> blocksizes(x, 4))(x)
@test bs4 == 1:1
end
end

end # module
Loading