Skip to content

Commit

Permalink
replace signature change with ArgumentError
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed Nov 9, 2024
1 parent d4b18e6 commit 3ee4ffc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion base/abstractarraymath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ julia> repeat([1, 2, 3], 2, 3)
3 3 3
```
"""
function repeat(A::AbstractArray, counts::Integer...)
function repeat(A::AbstractArray, counts...)
return repeat(A, outer=counts)
end

Expand Down Expand Up @@ -518,6 +518,9 @@ function check(arr, inner, outer)
# TODO: Currently one based indexing is demanded for inner !== nothing,
# but not for outer !== nothing. Decide for something consistent.
Base.require_one_based_indexing(arr)
if !all(n -> n isa Integer, inner)
throw(ArgumentError("repeat requires integer counts, got inner = $inner"))
end
if any(<(0), inner)
throw(ArgumentError("no inner repetition count may be negative; got $inner"))
end
Expand All @@ -526,6 +529,9 @@ function check(arr, inner, outer)
end
end
if outer !== nothing
if !all(n -> n isa Integer, outer)
throw(ArgumentError("repeat requires integer counts, got outer = $outer"))
end
if any(<(0), outer)
throw(ArgumentError("no outer repetition count may be negative; got $outer"))
end
Expand Down

0 comments on commit 3ee4ffc

Please sign in to comment.