diff --git a/README.md b/README.md index dfc1a923a..8503500f5 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,8 @@ Currently, the `@compat` macro supports the following syntaxes: * `fieldcount` is equivalent to `nfields` for Julia versions 0.6 and below and is used to determine the number of fields in a data type ([#22350]). +* There are versions of `InexactError`, `DomainError`, and `OverflowError` that take the same arguments as introduced in Julia 0.7-DEV ([#20005], [#22751], [#22761]). + ## Renamed functions @@ -311,6 +313,7 @@ includes this fix. Find the minimum version from there. [#20974]: https://github.com/JuliaLang/julia/issues/20974 [#21257]: https://github.com/JuliaLang/julia/issues/21257 [#21346]: https://github.com/JuliaLang/julia/issues/21346 +[#22005]: https://github.com/JuliaLang/julia/issues/22005 [#22064]: https://github.com/JuliaLang/julia/issues/22064 [#22182]: https://github.com/JuliaLang/julia/issues/22182 [#22350]: https://github.com/JuliaLang/julia/issues/22350 @@ -318,4 +321,6 @@ includes this fix. Find the minimum version from there. [#22633]: https://github.com/JuliaLang/julia/issues/22633 [#22629]: https://github.com/JuliaLang/julia/issues/22629 [#22666]: https://github.com/JuliaLang/julia/pull/22666 +[#22751]: https://github.com/JuliaLang/julia/pull/22751 +[#22761]: https://github.com/JuliaLang/julia/pull/22761 [#22864]: https://github.com/JuliaLang/julia/pull/22864 diff --git a/src/Compat.jl b/src/Compat.jl index c06d4e86e..3c323316e 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -488,6 +488,22 @@ if VERSION < v"0.7.0-DEV.1053" Base.read(obj::Cmd, ::Type{String}) = readstring(obj) end +# https://github.com/JuliaLang/julia/pull/20005 +if VERSION < v"0.7.0-DEV.896" + Base.InexactError(name::Symbol, T, val) = InexactError() +end + +# https://github.com/JuliaLang/julia/pull/22751 +if VERSION < v"0.7.0-DEV.924" + Base.DomainError(val) = DomainError() + Base.DomainError(val, msg) = DomainError() +end + +# https://github.com/JuliaLang/julia/pull/22761 +if VERSION < v"0.7.0-DEV.1285" + Base.OverflowError(msg) = OverflowError() +end + include("deprecated.jl") end # module Compat diff --git a/test/runtests.jl b/test/runtests.jl index efa8bc81a..bc0099145 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -658,6 +658,16 @@ eval(Expr(:type, false, :TestType, Expr(:block, :(a::Int), :b))) @test fieldcount(TestType) == 2 @test fieldcount(Int) == 0 +# PR 20005 +@test_throws InexactError throw(InexactError(:func, Int, 3.2)) + +# PR 22751 +@test_throws DomainError throw(DomainError(-2)) +@test_throws DomainError throw(DomainError(-2, "negative")) + +# PR 22761 +@test_throws OverflowError throw(OverflowError("overflow")) + let x = fill!(StringVector(5), 0x61) # 0.7 @test pointer(x) == pointer(String(x))