Skip to content

Commit

Permalink
Add union(::OneTo, ::OneTo) (#704)
Browse files Browse the repository at this point in the history
  • Loading branch information
goretkin authored Jun 8, 2020
1 parent 1bb5dc7 commit 234f390
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ Please check the list below for the specific syntax you need.

## Supported features

* `get` supports `CartesianIndex` when indexing `AbstractArrays` ([#30259]). (since Compat 3.10.0)
* `union` supports `Base.OneTo` ([#35577]). (since Compat 3.11.0)

* `get` supports `CartesianIndex` when indexing `AbstractArrays` ([#30268]). (since Compat 3.10.0)

* `similar(::PermutedDimsArray)` now uses the parent ([#35304]). (since Compat 3.9.0)

Expand Down Expand Up @@ -150,4 +152,5 @@ Note that you should specify the correct minimum version for `Compat` in the
[#34652]: https://github.com/JuliaLang/julia/issues/34652
[#34773]: https://github.com/JuliaLang/julia/issues/34773
[#35304]: https://github.com/JuliaLang/julia/pull/35304
[#30259]: https://github.com/JuliaLang/julia/pull/30268
[#30268]: https://github.com/JuliaLang/julia/pull/30268
[#35577]: https://github.com/JuliaLang/julia/pull/35577
5 changes: 5 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,11 @@ if VERSION < v"1.5.0-DEV.124"
export isdisjoint
end

# https://github.com/JuliaLang/julia/pull/35577
if VERSION < v"1.5.0-DEV.681"
Base.union(r::Base.OneTo, s::Base.OneTo) = Base.OneTo(max(r.stop,s.stop))
end

include("deprecated.jl")

end # module Compat
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -400,4 +400,9 @@ end
end
end

# https://github.com/JuliaLang/julia/pull/35577
@testset "union on OneTo" begin
@test union(Base.OneTo(3), Base.OneTo(4)) === Base.OneTo(4)
end

nothing

0 comments on commit 234f390

Please sign in to comment.