We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4f8e44b commit f6b5ae5Copy full SHA for f6b5ae5
base/broadcast.jl
@@ -282,9 +282,12 @@ end
282
Base.IteratorSize(::Type{T}) where {T<:Broadcasted} = Base.HasShape{ndims(T)}()
283
Base.ndims(BC::Type{<:Broadcasted{<:Any,Nothing}}) = _maxndims_broadcasted(BC)
284
function Base.ndims(BC::Type{<:Broadcasted{<:AbstractArrayStyle{N},Nothing}}) where {N}
285
+ # `N` is the `AbstractArrayStyle` type parameter, so `N isa Union{Type,Int}`.
286
if (N isa Type) && (Any <: N)
287
+ # for `N isa Type`, `Any` is the only allowed value, indicating a wildcard
288
_maxndims_broadcasted(BC)
289
else
290
+ # for `N isa Int`, only nonnegative values are allowed, indicating the number of dimensions
291
let n = N::Int
292
NTuple{n} # throw if negative
293
n
0 commit comments