Skip to content

Commit

Permalink
Update to ArrayInterace 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tokazama committed Jan 25, 2022
1 parent 4625ec9 commit 18ad693
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name = "Metadata"
uuid = "4fb893c1-3164-4f58-823a-cb4c64eabb4f"
authors = ["Zachary P. Christensen <[email protected]>"]
version = "0.3"
version = "0.3.1"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
ArrayInterface = "3"
julia = "1"
ArrayInterface = "4"
julia = "1.6"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Expand Down
11 changes: 2 additions & 9 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,11 @@ attach_metadata(1:2, ::NamedTuple{(:m1, :m2), Tuple{Int64, Vector{Int64}}})
```
"""
struct MetaUnitRange{T,P<:AbstractRange{T},M} <: AbstractUnitRange{T}
struct MetaUnitRange{T,P<:AbstractUnitRange{T},M} <: AbstractUnitRange{T}
parent::P
metadata::M

function MetaUnitRange{T,P,M}(p::P, m::M) where {T,P,M}
if known_step(P) == oneunit(T)
return new{T,P,M}(p, m)
else
throw(ArgumentError("step must be 1, got $(step(p))"))
end
end

MetaUnitRange{T,P,M}(p::P, m::M) where {T,P,M} = new{T,P,M}(p, m)
function MetaUnitRange{T}(p::AbstractRange, m) where {T}
if eltype(p) <: T
return MetaUnitRange{T,typeof(p),typeof(m)}(p, m)
Expand Down
1 change: 0 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ end
@test mx[1:2:10] == x[1:2:10]
@test mx[:] == x[:]
@test eltype(Metadata.MetaUnitRange{UInt}(1:10, nothing)) <: UInt
@test_throws ArgumentError Metadata.MetaUnitRange(1:3:10, nothing)
Metadata.test_wrapper(Metadata.MetaUnitRange, 1:10)
end

Expand Down

0 comments on commit 18ad693

Please sign in to comment.