Intervals.jl
Intervals.jl copied to clipboard
bug in `intersect`
julia> using Intervals
julia> intersect([Interval{Int, Closed, Open}(1,3), Interval{Int, Closed, Open}(3,5)])
1-element Vector{Interval{Int64, Closed, Open}}:
Interval{Int64, Closed, Open}(1, 5)
Those two intervals don't have any common elements, so they don't intersect.
That call doesn't actually take the intersection of the two intervals.
To do that:
julia> intersect(Interval{Int, Closed, Open}(1,3), Interval{Int, Closed, Open}(3,5))
Interval{Int64, Open, Open}(0, 0)
Intersect of one argument is an identity operation. For some reason Julia dispatches intersect(s) = union(s)
, so the misleading union
method on arrays of intervals that is currently deprecated takes over. Once that deprecated method is removed, this call will return an array containing the same intervals in the same order.
Oh! Ok. That's pretty confusing. Can we do a breaking release & drop the deprecation?
Seems reasonable, although it might be good to address any invalidations that still exist at the same time.