Skip to content

Commit

Permalink
use an explicit error check instead of the obscure type application
Browse files Browse the repository at this point in the history
  • Loading branch information
nsajko committed Jan 9, 2025
1 parent f6b5ae5 commit 5f43d7d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ function Base.ndims(BC::Type{<:Broadcasted{<:AbstractArrayStyle{N},Nothing}}) wh
else
# for `N isa Int`, only nonnegative values are allowed, indicating the number of dimensions
let n = N::Int
NTuple{n} # throw if negative
if n < 0
throw(ArgumentError("dimension count must not be negative"))
end
n
end
end
Expand Down

0 comments on commit 5f43d7d

Please sign in to comment.