diff --git a/base/multidimensional.jl b/base/multidimensional.jl index e26ae13664f2b8..b16a203ed6dac4 100644 --- a/base/multidimensional.jl +++ b/base/multidimensional.jl @@ -999,7 +999,9 @@ See also [`circshift`](@ref). axes(dest) == inds || throw(ArgumentError("indices of src and dest must match (got $inds and $(axes(dest)))")) _circshift!(dest, (), src, (), inds, fill_to_length(shiftamt, 0, Val(N))) end -circshift!(dest::AbstractArray, src, shiftamt) = circshift!(dest, src, (shiftamt...,)) + +circshift!(dest::AbstractArray, src, shiftamt) = + circshift!(dest, src, map(Integer, (shiftamt...,))) # For each dimension, we copy the first half of src to the second half # of dest, and the second half of src to the first half of dest. This diff --git a/test/arrayops.jl b/test/arrayops.jl index e8acde4c8826e3..256b186b517a16 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -733,6 +733,15 @@ end dst=similar(src) s=(1,2,3) @inferred Base.circshift!(dst,src,s) + + src = [1 2 3; 4 5 6] + dst = similar(src) + @test circshift(src, (3, 2)) == [5 6 4; 2 3 1] + @test circshift(src, (3.0, 2.0)) == [5 6 4; 2 3 1] + res = circshift!(dst, src, (3, 2)) + @test res === dst == [5 6 4; 2 3 1] + res = circshift!(dst, src, (3.0, 2.0)) + @test res === dst == [5 6 4; 2 3 1] end @testset "circcopy" begin