Skip to content

Commit

Permalink
Specialize union for OneTo (#35577)
Browse files Browse the repository at this point in the history
  • Loading branch information
goretkin authored Apr 24, 2020
1 parent 745ad10 commit 641f444
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ function ==(r::AbstractRange, s::AbstractRange)
end

intersect(r::OneTo, s::OneTo) = OneTo(min(r.stop,s.stop))
union(r::OneTo, s::OneTo) = OneTo(max(r.stop,s.stop))

intersect(r::AbstractUnitRange{<:Integer}, s::AbstractUnitRange{<:Integer}) = max(first(r),first(s)):min(last(r),last(s))

Expand Down
1 change: 1 addition & 0 deletions test/ranges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,7 @@ end
@test i == (k += 1)
end
@test intersect(r, Base.OneTo(2)) == Base.OneTo(2)
@test union(r, Base.OneTo(4)) == Base.OneTo(4)
@test intersect(r, 0:5) == 1:3
@test intersect(r, 2) === intersect(2, r) === 2:2
@test findall(in(r), r) === findall(in(1:length(r)), r) ===
Expand Down

2 comments on commit 641f444

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt

Please sign in to comment.