Skip to content

Commit

Permalink
Always return a value in 1-d circshift! of abstractarray.jl (#53554)
Browse files Browse the repository at this point in the history
Co-authored-by: Sukera <11753998+Seelengrab@users.noreply.github.com>
Co-authored-by: Mosè Giordano <giordano@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 3, 2024
1 parent 0f902bf commit 7179050
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3656,9 +3656,9 @@ end
## 1-d circshift ##
function circshift!(a::AbstractVector, shift::Integer)
n = length(a)
n == 0 && return
n == 0 && return a
shift = mod(shift, n)
shift == 0 && return
shift == 0 && return a
l = lastindex(a)
reverse!(a, firstindex(a), l-shift)
reverse!(a, l-shift+1, lastindex(a))
Expand Down
8 changes: 8 additions & 0 deletions test/arrayops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,14 @@ end
oa = OffsetVector(copy(a), -1)
@test circshift!(oa, 1) === oa
@test oa == circshift(OffsetVector(a, -1), 1)

# 1d circshift! (#53554)
a = []
@test circshift!(a, 1) === a
@test circshift!(a, 1) == []
a = [1:5;]
@test circshift!(a, 10) === a
@test circshift!(a, 10) == 1:5
end

@testset "circcopy" begin
Expand Down

2 comments on commit 7179050

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Please sign in to comment.