diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 478d850..57d04af 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,8 +13,7 @@ jobs: fail-fast: false matrix: version: - - '0.7' - - '1.0' + - '1.6' - '1' # - 'nightly' os: diff --git a/Project.toml b/Project.toml index 5adfb5f..139c97c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,13 +1,13 @@ name = "IntervalSets" uuid = "8197267c-284f-5f27-9208-e0e47529a953" -version = "0.5.4" +version = "0.6.0" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [compat] -julia = "0.7, 1" +julia = "1.6" [extras] OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" diff --git a/src/IntervalSets.jl b/src/IntervalSets.jl index 051b052..f049519 100644 --- a/src/IntervalSets.jl +++ b/src/IntervalSets.jl @@ -62,9 +62,6 @@ isclosedset(d::AbstractInterval) = isleftclosed(d) && isrightclosed(d) "Is the interval open?" isopenset(d::AbstractInterval) = isleftopen(d) && isrightopen(d) -@deprecate isopen(d) isopenset(d) false -@deprecate isclosed(d) isclosedset(d) - eltype(::Type{AbstractInterval{T}}) where {T} = T @pure eltype(::Type{I}) where {I<:AbstractInterval} = eltype(supertype(I)) @@ -134,50 +131,6 @@ in(::Missing, I::TypedEndpointsInterval{:open,:open}) = !isempty(I) && missing in(::Missing, I::TypedEndpointsInterval{:closed,:open}) = !isempty(I) && missing in(::Missing, I::TypedEndpointsInterval{:open,:closed}) = !isempty(I) && missing -# The code below can be defined as -# ``` -# function in(a::AbstractInterval, b::AbstractInterval) -# Base.depwarn("`in(a::AbstractInterval, b::AbstractInterval)` (equivalently, `a ∈ b`) is deprecated in favor of `issubset(a, b)` (equivalently, `a ⊆ b`). Note that the behavior for empty intervals is also changing.", :in) -# return in_deprecation(a, b) -# end -# ``` -# but that makes ambiguity definition. -function in(a::AbstractInterval, b::TypedEndpointsInterval{:closed,:closed}) - Base.depwarn("`in(a::AbstractInterval, b::AbstractInterval)` (equivalently, `a ∈ b`) is deprecated in favor of `issubset(a, b)` (equivalently, `a ⊆ b`). Note that the behavior for empty intervals is also changing.", :in) - return in_deprecation(a, b) -end -function in(a::AbstractInterval, b::TypedEndpointsInterval{:open,:open}) - Base.depwarn("`in(a::AbstractInterval, b::AbstractInterval)` (equivalently, `a ∈ b`) is deprecated in favor of `issubset(a, b)` (equivalently, `a ⊆ b`). Note that the behavior for empty intervals is also changing.", :in) - return in_deprecation(a, b) -end -function in(a::AbstractInterval, b::TypedEndpointsInterval{:closed,:open}) - Base.depwarn("`in(a::AbstractInterval, b::AbstractInterval)` (equivalently, `a ∈ b`) is deprecated in favor of `issubset(a, b)` (equivalently, `a ⊆ b`). Note that the behavior for empty intervals is also changing.", :in) - return in_deprecation(a, b) -end -function in(a::AbstractInterval, b::TypedEndpointsInterval{:open,:closed}) - Base.depwarn("`in(a::AbstractInterval, b::AbstractInterval)` (equivalently, `a ∈ b`) is deprecated in favor of `issubset(a, b)` (equivalently, `a ⊆ b`). Note that the behavior for empty intervals is also changing.", :in) - return in_deprecation(a, b) -end - -in_deprecation(a::AbstractInterval, b::TypedEndpointsInterval{:closed,:closed}) = - (leftendpoint(a) ≥ leftendpoint(b)) & (rightendpoint(a) ≤ rightendpoint(b)) -in_deprecation(a::TypedEndpointsInterval{:open,:open}, b::TypedEndpointsInterval{:open,:open} ) = - (leftendpoint(a) ≥ leftendpoint(b)) & (rightendpoint(a) ≤ rightendpoint(b)) -in_deprecation(a::TypedEndpointsInterval{:closed,:open}, b::TypedEndpointsInterval{:open,:open} ) = - (leftendpoint(a) > leftendpoint(b)) & (rightendpoint(a) ≤ rightendpoint(b)) -in_deprecation(a::TypedEndpointsInterval{:open,:closed}, b::TypedEndpointsInterval{:open,:open} ) = - (leftendpoint(a) ≥ leftendpoint(b)) & (rightendpoint(a) < rightendpoint(b)) -in_deprecation(a::TypedEndpointsInterval{:closed,:closed}, b::TypedEndpointsInterval{:open,:open} ) = - (leftendpoint(a) > leftendpoint(b)) & (rightendpoint(a) < rightendpoint(b)) -in_deprecation(a::TypedEndpointsInterval{:closed}, b::TypedEndpointsInterval{:open,:closed} ) = - (leftendpoint(a) > leftendpoint(b)) & (rightendpoint(a) ≤ rightendpoint(b)) -in_deprecation(a::TypedEndpointsInterval{:open}, b::TypedEndpointsInterval{:open,:closed} ) = - (leftendpoint(a) ≥ leftendpoint(b)) & (rightendpoint(a) ≤ rightendpoint(b)) -in_deprecation(a::TypedEndpointsInterval{L,:closed}, b::TypedEndpointsInterval{:closed,:open}) where L = - (leftendpoint(a) ≥ leftendpoint(b)) & (rightendpoint(a) < rightendpoint(b)) -in_deprecation(a::TypedEndpointsInterval{L,:open}, b::TypedEndpointsInterval{:closed,:open}) where L = - (leftendpoint(a) ≥ leftendpoint(b)) & (rightendpoint(a) ≤ rightendpoint(b)) - isempty(A::TypedEndpointsInterval{:closed,:closed}) = leftendpoint(A) > rightendpoint(A) isempty(A::TypedEndpointsInterval) = leftendpoint(A) ≥ rightendpoint(A) @@ -211,9 +164,6 @@ end ⊇(A::AbstractInterval, B::AbstractInterval) = issubset(B, A) ⊊(A::AbstractInterval, B::AbstractInterval) = (A ≠ B) & (A ⊆ B) ⊋(A::AbstractInterval, B::AbstractInterval) = (A ≠ B) & (A ⊇ B) -if VERSION < v"1.1.0-DEV.123" - issubset(x, B::AbstractInterval) = issubset(convert(AbstractInterval, x), B) -end const _interval_hash = UInt == UInt64 ? 0x1588c274e0a33ad4 : 0x1e3f7252 diff --git a/src/interval.jl b/src/interval.jl index 13f55b4..c9e8fbe 100644 --- a/src/interval.jl +++ b/src/interval.jl @@ -229,7 +229,3 @@ ClosedInterval(i::AbstractUnitRange{I}) where {I<:Integer} = ClosedInterval{I}(m Base.promote_rule(::Type{Interval{L,R,T1}}, ::Type{Interval{L,R,T2}}) where {L,R,T1,T2} = Interval{L,R,promote_type(T1, T2)} - -# convert should only work if they represent the same thing. -@deprecate convert(::Type{R}, i::ClosedInterval{I}) where {R<:AbstractUnitRange,I<:Integer} R(i) -@deprecate length(i::ClosedInterval) IntervalSets.duration(i) diff --git a/test/findall.jl b/test/findall.jl index b2a1df9..e9fbb6c 100644 --- a/test/findall.jl +++ b/test/findall.jl @@ -139,13 +139,11 @@ end (-2u"m":0.1u"m":1u"m", -1.05u"m"..1u"km"), (-2u"m":0.1u"m":1u"m", -4u"m"..1u"km"), (-2u"m":0.1u"m":1u"m", -4.05u"m"..1u"km"), - ]; - VERSION >= v"1.4" ? [ (Date(2021, 1, 1):Day(1):Date(2021, 3, 1), Date(2020, 1, 11)..Date(2020, 2, 22)), (Date(2021, 1, 1):Day(1):Date(2021, 3, 1), Date(2021, 1, 11)..Date(2021, 2, 22)), (DateTime(2021, 1, 1):Millisecond(10000):DateTime(2021, 3, 1), DateTime(2020, 1, 11)..DateTime(2020, 2, 22)), (DateTime(2021, 1, 1):Millisecond(10000):DateTime(2021, 3, 1), DateTime(2021, 1, 11)..DateTime(2021, 2, 22)), - ] : []; + ] ] assert_in_interval(x, interval) assert_in_interval(reverse(x), interval)