This line does not work with broadcast styles that have fields, eg
import Broadcast: BroadcastStyle
struct MyStyle <: BroadcastStyle
some_info
end
BroadcastStyle(x::MyStyle, y::MyStyle) = MyStyle(compute_field(x.some_info, y.some_info))
A possible fix (in user code) is defining
Broadcast.result_style(::MyStyle, ::MyStyle)
but that function does not seem to be part of the API.
A possible fix (in Julia) would be
result_join(::Any, ::Any, x::S, y::S) where S<:BroadcastStyle = x # just pick the first
I wanted to ask if this matches the intention of #20740 before making a PR.