@@ -89,7 +89,7 @@ function broadcast_mutability(x, op, args::Vararg{Any,N}) where {N}
8989 return broadcast_mutability (typeof (x), op, typeof .(args)... )
9090end
9191
92- _checked_size (s, x:: AbstractArray ) = size (x) == s
92+ _checked_size (s, x:: AbstractArray ) = length (x) == s
9393_checked_size (:: Any , :: Any ) = true
9494_checked_size (:: Any , :: Tuple{} ) = true
9595function _checked_size (s, x:: Tuple )
@@ -102,13 +102,15 @@ end
102102# happen during broadcasting since we'll either need to return a different size
103103# to `x`, or multiple copies of an argument will be used for different parts of
104104# `x`. To simplify, let's just return `IsNotMutable` if the sizes are different,
105- # which will be slower but correct.
105+ # which will be slower but correct. This is slightly complicated by the fact
106+ # that some AbstractArray do not support `size`, so we check with `length`
107+ # instead. If the `size`s are different, a later error will be thrown.
106108function broadcast_mutability (
107109 x:: AbstractArray ,
108110 op,
109111 args:: Vararg{Any,N} ,
110112) where {N}
111- if ! _checked_size (size (x), args):: Bool
113+ if ! _checked_size (length (x), args):: Bool
112114 return IsNotMutable ()
113115 end
114116 return broadcast_mutability (typeof (x), op, typeof .(args)... )
0 commit comments