Skip to content

Commit 1602a4a

Browse files
committed
remove AbstractArrayStyle type piracy
1 parent 9655c21 commit 1602a4a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

base/broadcast.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,6 @@ BroadcastStyle(a::AbstractArrayStyle, ::Style{Tuple}) = a
137137
BroadcastStyle(::A, ::A) where A<:ArrayStyle = A()
138138
BroadcastStyle(::ArrayStyle, ::ArrayStyle) = Unknown()
139139
BroadcastStyle(::A, ::A) where A<:AbstractArrayStyle = A()
140-
Base.@pure function BroadcastStyle(a::A, b::B) where {A<:AbstractArrayStyle{M},B<:AbstractArrayStyle{N}} where {M,N}
141-
if Base.typename(A) === Base.typename(B)
142-
return A(Val(max(M, N)))
143-
end
144-
return Unknown()
145-
end
146140
# Any specific array type beats DefaultArrayStyle
147141
BroadcastStyle(a::AbstractArrayStyle{Any}, ::DefaultArrayStyle) = a
148142
BroadcastStyle(a::AbstractArrayStyle{N}, ::DefaultArrayStyle{N}) where N = a

test/broadcast.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,3 +929,9 @@ ret = @macroexpand @.([Int, Number] <: Real)
929929

930930
ret = @macroexpand @.([Int, Number] >: Real)
931931
@test ret == :([Int, Number] .>: Real)
932+
933+
934+
struct CustomStyle{T} <: Broadcast.AbstractArrayStyle{1} end
935+
Broadcast.BroadcastStyle(::CustomStyle{:A}, ::CustomStyle{:B}) = CustomStyle{:A}()
936+
@test Broadcast.result_style(CustomStyle{:A}(), CustomStyle{:B}()) ==
937+
Broadcast.result_style(CustomStyle{:B}(), CustomStyle{:A}()) == CustomStyle{:A}()

0 commit comments

Comments
 (0)