Skip to content

Commit ee80672

Browse files
committed
Don't check for invariant transform when the permutation and permuted are of different lengths
1 parent 9d0843f commit ee80672

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ArrayInterface"
22
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
3-
version = "3.1"
3+
version = "3.1.1"
44

55
[deps]
66
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"

src/static.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ function invariant_permutation(x::T, y::T) where {N,T<:Tuple{Vararg{StaticInt,N}
272272
end
273273

274274
permute(x::Tuple, perm::Val) = permute(x, static(perm))
275-
function permute(x::Tuple{Vararg{Any}}, perm::Tuple{Vararg{StaticInt}})
275+
permute(x::Tuple{Vararg{Any}}, perm::Tuple{Vararg{StaticInt}}) = eachop(getindex, x, perm)
276+
function permute(x::Tuple{Vararg{Any,K}}, perm::Tuple{Vararg{StaticInt,K}}) where {K}
276277
if invariant_permutation(perm, perm) isa False
277278
return eachop(getindex, x, perm)
278279
else

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ using OffsetArrays
358358

359359
@test @inferred(stride_rank(@SArray(zeros(2,2,2)))) == ((1, 2, 3))
360360
@test @inferred(stride_rank(A)) == ((1,2,3))
361+
@test @inferred(stride_rank(view(A,:,:,1))) == ((1,2))
362+
@test @inferred(stride_rank(view(A,:,:,1))) === ((ArrayInterface.StaticInt(1),ArrayInterface.StaticInt(2)))
361363
@test @inferred(stride_rank(PermutedDimsArray(A,(3,1,2)))) == ((3, 1, 2))
362364
@test @inferred(stride_rank(@view(PermutedDimsArray(A,(3,1,2))[2,1:2,:]))) == ((1, 2))
363365
@test @inferred(stride_rank(@view(PermutedDimsArray(A,(3,1,2))[2,1:2,:])')) == ((2, 1))

0 commit comments

Comments
 (0)