diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d95f92..220ea0a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,12 +32,12 @@ jobs: arch: x86 version: 1 steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v5 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 + - uses: actions/cache@v4 env: cache-name: cache-artifacts with: @@ -57,8 +57,8 @@ jobs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v5 + - uses: julia-actions/setup-julia@v2 with: version: 'nightly' - run: | diff --git a/Project.toml b/Project.toml index 6db438c..412170c 100644 --- a/Project.toml +++ b/Project.toml @@ -5,21 +5,13 @@ version = "0.4.0" [deps] ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" +StaticArrayInterface = "0d7ed370-da01-4f52-bd93-41d350b8b718" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] -ArrayInterface = "5" -Static = "0.6" -julia = "1.6" - -[extras] -Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" -ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" -Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" - -[targets] -test = ["Test", "Aqua", "ArrayInterface", "Documenter"] +ArrayInterface = "7" +Static = "1.2" +julia = "1.11" diff --git a/src/MetaArray.jl b/src/MetaArray.jl index aecaf12..6d056a4 100644 --- a/src/MetaArray.jl +++ b/src/MetaArray.jl @@ -31,16 +31,21 @@ for f in [:axes, :size, :stride] end # ArrayInterface traits that just need the parent type -for f in [:can_change_size, :defines_strides, :known_size, :known_length, :axes_types, +for f in [:defines_strides] + eval(:(ArrayInterface.$(f)(@nospecialize T::Type{<:MetaArray}) = ArrayInterface.$(f)(parent_type(T)))) +end + +# StaticArrayInterface traits that just need the parent type +for f in [:can_change_size, :known_size, :known_length, :axes_types, :known_offsets, :known_strides, :contiguous_axis, :contiguous_axis_indicator, :stride_rank, :contiguous_batch_size,:known_first, :known_last, :known_step] - eval(:(ArrayInterface.$(f)(@nospecialize T::Type{<:MetaArray}) = ArrayInterface.$(f)(parent_type(T)))) + eval(:(StaticArrayInterface.$(f)(@nospecialize T::Type{<:MetaArray}) = StaticArrayInterface.$(f)(parent_type(T)))) end Base.pointer(@nospecialize(x::MetaArray), n::Integer) = pointer(parent(x), n) for f in [:axes, :size, :strides, :offsets] - eval(:(ArrayInterface.$(f)(@nospecialize(x::MetaArray)) = ArrayInterface.$f(parent(x)))) + eval(:(StaticArrayInterface.$(f)(@nospecialize(x::MetaArray)) = StaticArrayInterface.$f(parent(x)))) end Base.copy(A::MetaArray) = copy_metadata(A, copy(parent(A))) diff --git a/src/MetaTuple.jl b/src/MetaTuple.jl index 4f5ee7b..80a1920 100644 --- a/src/MetaTuple.jl +++ b/src/MetaTuple.jl @@ -6,7 +6,7 @@ struct MetaTuple{N,P,M} global _MetaTuple(p::P, m::M) where {P,M} = new{length(p),P,M}(p, m) end -ArrayInterface.known_length(::Type{<:MetaTuple{N}}) where {N} = N +StaticArrayInterface.known_length(::Type{<:MetaTuple{N}}) where {N} = N Base.eltype(T::Type{<:MetaTuple}) = eltype(parent_type(T)) diff --git a/src/MetaUnitRange.jl b/src/MetaUnitRange.jl index 0ef9062..fd163b8 100644 --- a/src/MetaUnitRange.jl +++ b/src/MetaUnitRange.jl @@ -21,9 +21,9 @@ end Base.@propagate_inbounds Base.getindex(r::MetaUnitRange, i::Integer) = parent(r)[i] -ArrayInterface.known_first(::Type{T}) where {T<:MetaUnitRange} = known_first(parent_type(T)) +StaticArrayInterface.known_first(::Type{T}) where {T<:MetaUnitRange} = known_first(parent_type(T)) -ArrayInterface.known_last(::Type{T}) where {T<:MetaUnitRange} = known_last(parent_type(T)) +StaticArrayInterface.known_last(::Type{T}) where {T<:MetaUnitRange} = known_last(parent_type(T)) @propagate_inbounds Base.getindex(r::MetaUnitRange, i) = propagate_metadata(r, parent(r)[i]) diff --git a/src/Metadata.jl b/src/Metadata.jl index 42e2f5f..f03b76f 100644 --- a/src/Metadata.jl +++ b/src/Metadata.jl @@ -6,7 +6,9 @@ module Metadata end Metadata using ArrayInterface -using ArrayInterface: parent_type, known_first, known_last, known_step, StaticInt, to_dims, axes_types +using ArrayInterface: parent_type +using StaticArrayInterface +using StaticArrayInterface: known_first, known_last, known_step, StaticInt, to_dims, axes_types using Base: @propagate_inbounds, OneTo, tail using LinearAlgebra using Statistics diff --git a/test/MetaUnitRange.jl b/test/MetaUnitRange.jl index 9890a59..605bd34 100644 --- a/test/MetaUnitRange.jl +++ b/test/MetaUnitRange.jl @@ -8,9 +8,9 @@ mx = Metadata.test_wrapper(Metadata.MetaUnitRange, x) @test @inferred(step(x)) == step(mx) @test @inferred(last(x)) == last(mx) @test @inferred(length(mx)) == length(x) -@test ArrayInterface.known_first(mx) === ArrayInterface.known_first(x) -@test ArrayInterface.known_last(mx) === ArrayInterface.known_last(x) -@test ArrayInterface.known_step(mx) === ArrayInterface.known_step(x) +@test StaticArrayInterface.known_first(mx) === StaticArrayInterface.known_first(x) +@test StaticArrayInterface.known_last(mx) === StaticArrayInterface.known_last(x) +@test StaticArrayInterface.known_step(mx) === StaticArrayInterface.known_step(x) @test mx[1:2:10] == x[1:2:10] @test mx[:] == x[:] Metadata.test_wrapper(Metadata.MetaUnitRange, 1:10) diff --git a/test/Project.toml b/test/Project.toml index edfd9d0..45da473 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,5 +1,6 @@ [deps] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" +StaticArrayInterface = "0d7ed370-da01-4f52-bd93-41d350b8b718" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/runtests.jl b/test/runtests.jl index b294ec4..9937284 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,11 +1,13 @@ using ArrayInterface +using StaticArrayInterface using Aqua using Documenter using Metadata using Test -using ArrayInterface: parent_type, StaticInt +using ArrayInterface: parent_type +using StaticArrayInterface: StaticInt using Metadata: MetaArray, no_data Aqua.test_all(Metadata)