Skip to content

Commit f6b5ae5

Browse files
committed
add comments in method body
1 parent 4f8e44b commit f6b5ae5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

base/broadcast.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,12 @@ end
282282
Base.IteratorSize(::Type{T}) where {T<:Broadcasted} = Base.HasShape{ndims(T)}()
283283
Base.ndims(BC::Type{<:Broadcasted{<:Any,Nothing}}) = _maxndims_broadcasted(BC)
284284
function Base.ndims(BC::Type{<:Broadcasted{<:AbstractArrayStyle{N},Nothing}}) where {N}
285+
# `N` is the `AbstractArrayStyle` type parameter, so `N isa Union{Type,Int}`.
285286
if (N isa Type) && (Any <: N)
287+
# for `N isa Type`, `Any` is the only allowed value, indicating a wildcard
286288
_maxndims_broadcasted(BC)
287289
else
290+
# for `N isa Int`, only nonnegative values are allowed, indicating the number of dimensions
288291
let n = N::Int
289292
NTuple{n} # throw if negative
290293
n

0 commit comments

Comments
 (0)