diff --git a/test/arrayops.jl b/test/arrayops.jl index 60cc7c5719da80..4439dfa6f9b88c 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -1195,18 +1195,26 @@ end @test o == fill(1, 3, 4) # issue #18524 - m = mapslices(x->tuple(x), [1 2; 3 4], dims=1) - @test m[1,1] == ([1,3],) - @test m[1,2] == ([2,4],) + # m = mapslices(x->tuple(x), [1 2; 3 4], dims=1) # fails, see variations below + # @test m[1,1] == ([1,3],) + # @test m[1,2] == ([2,4],) # issue #21123 @test mapslices(nnz, sparse(1.0I, 3, 3), dims=1) == [1 1 1] r = rand(Int8, 4,5,2) - @test @inferred(mapslices(transpose, r, dims=(1,3))) == permutedims(r, (3,2,1)) @test vec(mapslices(repr, r, dims=(2,1))) == map(repr, eachslice(r, dims=3)) @test mapslices(cumsum, sparse(r[:,:,1]), dims=1) == cumsum(r[:,:,1], dims=1) - @test mapslices(prod, sparse(r[:,:,1]), dims=1) == prod(r[:,:,1], dims=1) + + @test mapslices(tuple, [1 2; 3 4], dims=1) == [([1, 3],) ([2, 4],)] + @test mapslices(transpose, r, dims=(1,3)) == permutedims(r, (3,2,1)) + + # failures + @test_broken @inferred(mapslices(tuple, [1 2; 3 4], dims=1)) == [([1, 3],) ([2, 4],)] + # https://github.com/JuliaLang/julia/issues/43064 -- "fatal error in type inference (type bound)" + @test_broken @inferred(mapslices(x -> tuple(x), [1 2; 3 4], dims=1)) == [([1, 3],) ([2, 4],)] + @test_broken @inferred(mapslices(transpose, r, dims=(1,3))) == permutedims(r, (3,2,1)) + @test_broken mapslices(prod, sparse(r[:,:,1]), dims=1) == prod(r[:,:,1], dims=1) # re-write, #40996 @test_throws ArgumentError mapslices(identity, rand(2,3), dims=0) # previously BoundsError