Skip to content

Commit

Permalink
Drop compat code for invokelatest from #424
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Sep 30, 2019
1 parent 4540a1f commit f9257b4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ Currently, the `@compat` macro supports the following syntaxes:

* `isnothing` for testing if a variable is equal to `nothing` ([#29674]).

* `Compat.invokelatest` supports keywords ([#22646]).

* `Cmd` elements can be accessed as if the `Cmd` were an array of strings for 0.6 and below ([#21197]).

* `Val(x)` constructs `Val{x}()`. ([#22475])
Expand Down
11 changes: 1 addition & 10 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,10 @@ module TypeUtils
const isabstract = isabstracttype
export isabstract, parameter_upper_bound, typename
end # module TypeUtils
import Base.invokelatest

include("compatmacro.jl")

# https://github.com/JuliaLang/julia/pull/22646
if VERSION < v"0.7.0-DEV.1139"
function invokelatest(f, args...; kwargs...)
inner() = f(args...; kwargs...)
Base.invokelatest(inner)
end
else
import Base.invokelatest
end

# https://github.com/JuliaLang/julia/pull/21197
if VERSION < v"0.7.0-DEV.257"
# allow the elements of the Cmd to be accessed as an array or iterator
Expand Down
10 changes: 10 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ struct ConcreteFoo20006N{T<:Int,N} <: AbstractFoo20006 end
@test Compat.TypeUtils.parameter_upper_bound(ConcreteFoo20006, 1) == Int
@test isa(Compat.TypeUtils.typename(Array), Core.TypeName)

# invokelatest with keywords
pr22646(x; y=0) = 1
let foo() = begin
eval(:(pr22646(x::Int; y=0) = 2))
return Compat.invokelatest(pr22646, 0, y=1)
end
@test foo() == 2
end


# tests of removed functionality (i.e. justs tests Base)

# 25959
Expand Down
9 changes: 0 additions & 9 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,6 @@ for x in (3.1, -17, 3//4, big(111.1), Inf)
@test minmax(x) == (x, x)
end

# invokelatest with keywords
pr22646(x; y=0) = 1
let foo() = begin
eval(:(pr22646(x::Int; y=0) = 2))
return Compat.invokelatest(pr22646, 0, y=1)
end
@test foo() == 2
end

# PR #21197
let c = `ls -l "foo bar"`
@test collect(c) == ["ls", "-l", "foo bar"]
Expand Down

0 comments on commit f9257b4

Please sign in to comment.