Skip to content

Commit 484e347

Browse files
committed
More general fix
1 parent cdf333a commit 484e347

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/BlockArraysExtensions/BlockArraysExtensions.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,11 @@ function _blockreshape(a::AbstractArray, axes::Tuple{Vararg{AbstractUnitRange}})
277277
# TODO: Better converter here.
278278
return reshape(reshaped_blocks_a[I], block_axes_I)
279279
end
280-
bs = if iszero(storedlength(reshaped_blocks_a))
280+
bs = Dict(Block(Tuple(I)) => f(I) for I in eachstoredindex(reshaped_blocks_a))
281+
if !isconcretetype(eltype(bs))
281282
# This branch only seems to be required in Julia 1.10, not Julia 1.11.
282283
# TODO: Remove this branch once Julia 1.10 support is dropped.
283-
Dict{Block{length(axes),Int},AbstractArray{eltype(a),length(axes)}}()
284-
else
285-
Dict(Block(Tuple(I)) => f(I) for I in eachstoredindex(reshaped_blocks_a))
284+
bs = Dict{Block{length(axes),Int},AbstractArray{eltype(a),length(axes)}}()
286285
end
287286
return blocksparse(bs, axes)
288287
end

0 commit comments

Comments
 (0)