From 6a8f49fa8521a1fd9abd18532a399443b27f0cbf Mon Sep 17 00:00:00 2001 From: Martin Holters Date: Mon, 30 Sep 2019 17:03:09 +0200 Subject: [PATCH] Drop compat code for `invokelatest` from #424 --- README.md | 2 -- src/Compat.jl | 11 +---------- test/old.jl | 10 ++++++++++ test/runtests.jl | 9 --------- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index fad54de45..0b589d82b 100644 --- a/README.md +++ b/README.md @@ -120,8 +120,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]) diff --git a/src/Compat.jl b/src/Compat.jl index 4afd0cbc1..ee7341489 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -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 diff --git a/test/old.jl b/test/old.jl index f5ae0ca77..a243f9039 100644 --- a/test/old.jl +++ b/test/old.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index 289587ea8..00ac5d983 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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"]