diff --git a/Project.toml b/Project.toml index 18a80c1cc..f4f18cba1 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ArrayInterface" uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" -version = "3.1" +version = "3.1.1" [deps] IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" diff --git a/src/static.jl b/src/static.jl index 887cd4ddb..b2475c0fa 100644 --- a/src/static.jl +++ b/src/static.jl @@ -272,7 +272,8 @@ function invariant_permutation(x::T, y::T) where {N,T<:Tuple{Vararg{StaticInt,N} end permute(x::Tuple, perm::Val) = permute(x, static(perm)) -function permute(x::Tuple{Vararg{Any}}, perm::Tuple{Vararg{StaticInt}}) +permute(x::Tuple{Vararg{Any}}, perm::Tuple{Vararg{StaticInt}}) = eachop(getindex, x, perm) +function permute(x::Tuple{Vararg{Any,K}}, perm::Tuple{Vararg{StaticInt,K}}) where {K} if invariant_permutation(perm, perm) isa False return eachop(getindex, x, perm) else diff --git a/test/runtests.jl b/test/runtests.jl index ec46e47ff..2ec14df75 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -358,6 +358,8 @@ using OffsetArrays @test @inferred(stride_rank(@SArray(zeros(2,2,2)))) == ((1, 2, 3)) @test @inferred(stride_rank(A)) == ((1,2,3)) + @test @inferred(stride_rank(view(A,:,:,1))) == ((1,2)) + @test @inferred(stride_rank(view(A,:,:,1))) === ((ArrayInterface.StaticInt(1),ArrayInterface.StaticInt(2))) @test @inferred(stride_rank(PermutedDimsArray(A,(3,1,2)))) == ((3, 1, 2)) @test @inferred(stride_rank(@view(PermutedDimsArray(A,(3,1,2))[2,1:2,:]))) == ((1, 2)) @test @inferred(stride_rank(@view(PermutedDimsArray(A,(3,1,2))[2,1:2,:])')) == ((2, 1))