Skip to content

Commit

Permalink
Add support for multiarg InexactError, DomainError, OverflowError
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Aug 8, 2017
1 parent 8281370 commit 4936541
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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/222761
if VERSION < v"0.7.0-DEV.1285"
Base.OverflowError(msg) = OverflowError()
end

include("deprecated.jl")

end # module Compat
10 changes: 10 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 4936541

Please sign in to comment.