diff --git a/base/abstractarraymath.jl b/base/abstractarraymath.jl index 0430293b46737..726c8c06ae851 100644 --- a/base/abstractarraymath.jl +++ b/base/abstractarraymath.jl @@ -415,7 +415,7 @@ _reperr(s, n, N) = throw(ArgumentError("number of " * s * " repetitions " * n = inner[i] inner_indices[i] = (1:n) + ((c[i] - 1) * n) end - R[inner_indices...] = A[c] + fill!(view(R, inner_indices...), A[c]) end end diff --git a/test/arrayops.jl b/test/arrayops.jl index dc4c60675ba45..cfe5a5c34c036 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -793,6 +793,11 @@ end R = repeat(1:2, inner=(3,), outer=(2,)) @test R == [1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2] + # Arrays of arrays + @test repeat([[1], [2]], inner=2) == [[1], [1], [2], [2]] + @test repeat([[1], [2]], outer=2) == [[1], [2], [1], [2]] + @test repeat([[1], [2]], inner=2, outer=2) == [[1], [1], [2], [2], [1], [1], [2], [2]] + @test size(repeat([1], inner=(0,))) == (0,) @test size(repeat([1], outer=(0,))) == (0,) @test size(repeat([1 1], inner=(0, 1))) == (0, 2)