@@ -742,19 +742,20 @@ const NonleafHandlingStyles = Union{DefaultArrayStyle,ArrayConflict}
742
742
# When ElType is not concrete, use narrowing. Use the first output
743
743
# value to determine the starting output eltype; copyto_nonleaf!
744
744
# will widen `dest` as needed to accommodate later values.
745
- iter = CartesianIndices (axes (bc))
745
+ bc′ = preprocess (nothing , bc)
746
+ iter = CartesianIndices (axes (bc′))
746
747
state = start (iter)
747
748
if done (iter, state)
748
749
# if empty, take the ElType at face value
749
- return broadcast_similar (Style (), ElType, axes (bc), bc)
750
+ return broadcast_similar (Style (), ElType, axes (bc′ ), bc′ )
750
751
end
751
752
# Initialize using the first value
752
753
I, state = next (iter, state)
753
- @inbounds val = bc[I]
754
- dest = broadcast_similar (Style (), typeof (val), axes (bc), bc)
754
+ @inbounds val = bc′ [I]
755
+ dest = broadcast_similar (Style (), typeof (val), axes (bc′ ), bc′ )
755
756
@inbounds dest[I] = val
756
757
# Now handle the remaining values
757
- return copyto_nonleaf! (dest, bc, iter, state, 1 )
758
+ return copyto_nonleaf! (dest, bc′ , iter, state, 1 )
758
759
end
759
760
760
761
# # general `copyto!` methods
787
788
# LHS and RHS will always match. This is not true in general, but with the `.op=`
788
789
# syntax it's fairly common for an argument to be `===` a source.
789
790
broadcast_unalias (dest, src) = dest === src ? src : unalias (dest, src)
791
+ broadcast_unalias (:: Nothing , src) = src
790
792
791
793
# Preprocessing a `Broadcasted` does two things:
792
794
# * unaliases any arguments from `dest`
0 commit comments