Skip to content

Commit

Permalink
Drop compat code for at-cfunction from #553 and #566
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Oct 8, 2019
1 parent ae2243d commit 8e589b9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 25 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ Currently, the `@compat` macro supports the following syntaxes:
* `Compat.split` and `Compat.rsplit` accept `keepempty` keyword argument
if `splitter` is given as second argument ([#26634])

* `cfunction` is now `@cfunction` ([#26486]).

* `vecnorm` and `vecdot` are now `Compat.norm` and `Compat.dot`, respectively, while the
old `norm(A::AbstractMatrix, p=2)` is now `Compat.opnorm` ([#27401]). `import Compat: ⋅`
to get `Compat.dot` as the binary operator ``.
Expand Down
8 changes: 0 additions & 8 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@ end
end
end

# 0.7.0-DEV.4762
@static if !isdefined(Base, Symbol("@cfunction"))
macro cfunction(f, rt, tup)
:(Base.cfunction($(esc(f)), $(esc(rt)), Tuple{$(esc(tup))...}))
end
export @cfunction
end

if VERSION < v"0.7.0-DEV.2920" # julia#24999
Base.length(s::AbstractString, i::Integer, j::Integer) = length(s, Int(i), Int(j))
function Base.length(s::AbstractString, i::Int, j::Int)
Expand Down
15 changes: 15 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1079,3 +1079,18 @@ end
# 0.7.0-DEV.4905
@test isbitstype(Int)
@test !isbitstype(Vector{Int})

# 0.7.0-DEV.4762
let ptr = @cfunction(+, Int, (Int, Int))
@test ptr isa Ptr{Cvoid}
@test ptr != C_NULL
@test ccall(ptr, Int, (Int, Int), 2, 3) == 5
end
# issue #565
issue565(x) = x + 1
const Issue565 = Int
let bar() = @cfunction(issue565, Issue565, (Issue565,)), ptr = bar()
@test ptr isa Ptr{Cvoid}
@test ptr != C_NULL
@test ccall(ptr, Int, (Int,), 2) === 3
end
15 changes: 0 additions & 15 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,6 @@ end
@test length(Compat.CartesianIndices((1:2,))) == 2
@test length(Compat.CartesianIndices((1:2, -1:1))) == 6

# 0.7.0-DEV.4762
let ptr = @cfunction(+, Int, (Int, Int))
@test ptr isa Ptr{Cvoid}
@test ptr != C_NULL
@test ccall(ptr, Int, (Int, Int), 2, 3) == 5
end
# issue #565
issue565(x) = x + 1
const Issue565 = Int
let bar() = @cfunction(issue565, Issue565, (Issue565,)), ptr = bar()
@test ptr isa Ptr{Cvoid}
@test ptr != C_NULL
@test ccall(ptr, Int, (Int,), 2) === 3
end

# 0.7.0-DEV.5278
@test something(nothing, 1) === 1
@test something(Some(2)) === 2
Expand Down

0 comments on commit 8e589b9

Please sign in to comment.