Skip to content

Commit fbd72e5

Browse files
Remove tuple_tools and if-else branch to fix type instability
1 parent 871f835 commit fbd72e5

File tree

5 files changed

+5
-92
lines changed

5 files changed

+5
-92
lines changed

src/blockbroadcast.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,14 @@ BroadcastStyle(::PseudoBlockStyle{M}, ::BlockStyle{N}) where {M,N} = BlockStyle(
2929

3030

3131
# sortedunion can assume inputs are already sorted so this could be improved
32-
include("tuple_tools.jl")
3332
sortedunion(a,b) = sort!(union(a,b))
34-
sortedunion(a::Tuple, b::Tuple) = tuple_sort(tuple_union(a,b))
3533
sortedunion(a::Base.OneTo, b::Base.OneTo) = Base.OneTo(max(last(a),last(b)))
3634
sortedunion(a::AbstractUnitRange, b::AbstractUnitRange) = min(first(a),first(b)):max(last(a),last(b))
3735
combine_blockaxes(a, b) = _BlockedUnitRange(sortedunion(blocklasts(a), blocklasts(b)))
3836

39-
Base.Broadcast.axistype(a::BlockedUnitRange, b::BlockedUnitRange) = length(b) == 1 ? a : combine_blockaxes(a, b)
40-
Base.Broadcast.axistype(a::BlockedUnitRange, b) = length(b) == 1 ? a : combine_blockaxes(a, b)
41-
Base.Broadcast.axistype(a, b::BlockedUnitRange) = length(b) == 1 ? a : combine_blockaxes(a, b)
37+
Base.Broadcast.axistype(a::BlockedUnitRange, b::BlockedUnitRange) = combine_blockaxes(a, b)
38+
Base.Broadcast.axistype(a::BlockedUnitRange, b) = combine_blockaxes(a, b)
39+
Base.Broadcast.axistype(a, b::BlockedUnitRange) = combine_blockaxes(a, b)
4240

4341

4442
similar(bc::Broadcasted{<:AbstractBlockStyle{N}}, ::Type{T}) where {T,N} =

src/tuple_tools.jl

Lines changed: 0 additions & 51 deletions
This file was deleted.

test/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ include("test_blockproduct.jl")
2929
include("test_blockreduce.jl")
3030
include("test_blockdeque.jl")
3131
include("test_blockcholesky.jl")
32-
include("test_tuple_tools.jl")

test/test_blockbroadcast.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ import BlockArrays: SubBlockIterator, BlockIndexRange, Diagonal
185185

186186
shape1 = (BlockArrays._BlockedUnitRange((2,)),);
187187
shape2 = (BlockArrays._BlockedUnitRange((2,)),);
188+
@inferred Base.Broadcast.axistype(shape1[1], shape2[1])
189+
@inferred BlockArrays.combine_blockaxes(shape1[1], shape2[1])
188190
@inferred Base.Broadcast.broadcast_shape(shape1, shape2)
189191
@code_warntype Base.Broadcast.broadcast_shape(shape1, shape2)
190192
end

test/test_tuple_tools.jl

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)