Skip to content

Commit

Permalink
Drop compat code for finalizer from #416
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Oct 8, 2019
1 parent f44606b commit a5cd87b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]).
Expand Down
5 changes: 0 additions & 5 deletions src/compatmacro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 0 additions & 11 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a5cd87b

Please sign in to comment.