Skip to content

Commit

Permalink
Add compat for AbstractRange
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao committed Sep 13, 2017
1 parent 9561962 commit bf9ecc3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Currently, the `@compat` macro supports the following syntaxes:
`read(::IO, ::Type{String})`, `read(::AbstractString, ::Type{String})`,
and `read(::Cmd, ::Type{String})` are defined for 0.6 and below.

* `Range` is now `AbstractRange` ([#23570])

## New macros

Expand Down Expand Up @@ -305,3 +306,4 @@ includes this fix. Find the minimum version from there.
[#22751]: https://github.com/JuliaLang/julia/issues/22751
[#22761]: https://github.com/JuliaLang/julia/issues/22761
[#22864]: https://github.com/JuliaLang/julia/issues/22864
[#23570]: https://github.com/JuliaLang/julia/issues/23570
6 changes: 6 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,12 @@ if VERSION < v"0.7.0-DEV.1285"
Base.OverflowError(msg) = OverflowError()
end

# 0.7.0-DEV.1721
@static if !isdefined(Base, :AbstractRange)
const AbstractRange = Range
export AbstractRange
end

include("deprecated.jl")

end # module Compat
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,9 @@ no_specialize(@nospecialize(x::Integer)) = sin(2)
@test contains(read(@__FILE__, String), "read(@__FILE__, String)")
@test read(`$(Base.julia_cmd()) --startup-file=no -e "println(:aaaa)"`, String) == "aaaa\n"

# 0.7
@test isa(1:2, AbstractRange)

if VERSION < v"0.6.0"
include("deprecated.jl")
end
Expand Down

0 comments on commit bf9ecc3

Please sign in to comment.