Skip to content

Commit 1f8d0ad

Browse files
committed
Fix stridelayout tests
1 parent f6d758c commit 1f8d0ad

File tree

4 files changed

+106
-105
lines changed

4 files changed

+106
-105
lines changed

lib/ArrayInterfaceCore/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ArrayInterfaceCore"
22
uuid = "30b0a656-2188-435a-8636-2ec0e6a096e2"
3-
version = "0.1.6"
3+
version = "0.1.7"
44

55
[deps]
66
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

lib/ArrayInterfaceCore/src/ArrayInterfaceCore.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ function known_first(::Type{T}) where {T}
471471
end
472472
end
473473
known_first(::Type{Base.OneTo{T}}) where {T} = 1
474+
known_first(::Type{<:Base.IdentityUnitRange{T}}) where {T} = known_first(T)
474475
function known_first(::Type{<:CartesianIndices{N,R}}) where {N,R}
475476
_cartesian_index(ntuple(i -> known_first(R.parameters[i]), Val(N)))
476477
end

test/setup.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ArrayInterface, Static, LinearAlgebra
22

3-
struct MArray{T,N,R} <: AbstractArray{T,N}
3+
struct MArray{T,N,R} <: DenseArray{T,N}
44
parent::Array{T,N}
55
indices::LinearIndices{N,R}
66
end
@@ -14,6 +14,7 @@ Base.axes(x::MArray) = ArrayInterface.axes(x)
1414
ArrayInterface.axes_types(T::Type{<:MArray}) = T.parameters[3]
1515
#ArrayInterface.size(x::MArray) = ArrayInterface.size(x.indices)
1616
ArrayInterface.defines_strides(::Type{<:MArray}) = true
17+
Base.strides(x::MArray) = strides(parent(x))
1718
function Base.getindex(x::MArray, inds...)
1819
@boundscheck checkbounds(x, inds...)
1920
@inbounds parent(x)[inds...]
@@ -49,9 +50,8 @@ struct Wrapper{T,N,P<:AbstractArray{T,N}} <: ArrayInterface.AbstractArray2{T,N}
4950
end
5051
ArrayInterface.parent_type(::Type{<:Wrapper{T,N,P}}) where {T,N,P} = P
5152
Base.parent(x::Wrapper) = x.parent
52-
ArrayInterface.device(::Type{T}) where {T<:Wrapper} = device(parent_type(T))
53+
ArrayInterface.device(::Type{T}) where {T<:Wrapper} = ArrayInterface.device(ArrayInterface.parent_type(T))
5354

5455
struct DenseWrapper{T,N,P<:AbstractArray{T,N}} <: DenseArray{T,N} end
5556
ArrayInterface.parent_type(::Type{DenseWrapper{T,N,P}}) where {T,N,P} = P
5657

57-

0 commit comments

Comments
 (0)