From a5cd87b599ef452b2d233a84ae1a5103483d9e9a Mon Sep 17 00:00:00 2001 From: Martin Holters Date: Tue, 8 Oct 2019 20:27:20 +0200 Subject: [PATCH] Drop compat code for `finalizer` from #416 --- README.md | 3 --- src/compatmacro.jl | 5 ----- test/old.jl | 11 +++++++++++ test/runtests.jl | 11 ----------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 271f1cca8..207dbe416 100644 --- a/README.md +++ b/README.md @@ -54,9 +54,6 @@ Currently, the `@compat` macro supports the following syntaxes: * `isnothing` for testing if a variable is equal to `nothing` ([#29674]). -* `@compat finalizer(func, obj)` with the finalizer to run as the first argument and the object to be finalized - as the second ([#24605]). - * `range` supporting `stop` as positional argument ([#28708]). * `hasproperty` and `hasfield` ([#28850]). diff --git a/src/compatmacro.jl b/src/compatmacro.jl index 28714935d..b8167a7bf 100644 --- a/src/compatmacro.jl +++ b/src/compatmacro.jl @@ -11,11 +11,6 @@ function _compat(ex::Expr) # Passthrough return ex end - if VERSION < v"0.7.0-DEV.2562" - if ex.head == :call && ex.args[1] == :finalizer - ex.args[2], ex.args[3] = ex.args[3], ex.args[2] - end - end return Expr(ex.head, map(_compat, ex.args)...) end diff --git a/test/old.jl b/test/old.jl index 6df6d0a95..dab17180e 100644 --- a/test/old.jl +++ b/test/old.jl @@ -1301,3 +1301,14 @@ let @test cr(CartesianIndices((5, 3))) == 2 @test_throws MethodError cr(CartesianIndices((5, 3, 2))) end + +# 0.7 +let A = [1] + local x = 0 + @compat finalizer(a->(x+=1), A) + finalize(A) + @test x == 1 + A = 0 + GC.gc(); GC.gc() + @test x == 1 +end diff --git a/test/runtests.jl b/test/runtests.jl index 863bd192d..f5e3935c0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -55,17 +55,6 @@ for x in (3.1, -17, 3//4, big(111.1), Inf) @test minmax(x) == (x, x) end -# 0.7 -let A = [1] - local x = 0 - @compat finalizer(a->(x+=1), A) - finalize(A) - @test x == 1 - A = 0 - GC.gc(); GC.gc() - @test x == 1 -end - # Support for positional `stop` @test Compat.range(0, 5, length = 6) == 0.0:1.0:5.0 @test Compat.range(0, 10, step = 2) == 0:2:10