Skip to content

Commit

Permalink
Drop compat code for at-__MODULE__ (from #363)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Oct 8, 2019
1 parent 0ba707d commit 20b3ff8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ Currently, the `@compat` macro supports the following syntaxes:

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

* `@__MODULE__` is aliased to `current_module()` for Julia versions 0.6 and below. Versions of `Base.binding_module`, `expand`, `macroexpand`, and `include_string` were added that accept a module as the first argument. ([#22064])

* `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
15 changes: 0 additions & 15 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,6 @@ import Sockets

include("compatmacro.jl")

# https://github.com/JuliaLang/julia/pull/22064
@static if !isdefined(Base, Symbol("@__MODULE__"))
# 0.7
export @__MODULE__
macro __MODULE__()
return current_module()
end
Base.expand(mod::Module, x::ANY) = eval(mod, :(expand($(QuoteNode(x)))))
Base.macroexpand(mod::Module, x::ANY) = eval(mod, :(macroexpand($(QuoteNode(x)))))
Base.include_string(mod::Module, code::String, fname::String) =
eval(mod, :(include_string($code, $fname)))
Base.include_string(mod::Module, code::AbstractString, fname::AbstractString="string") =
eval(mod, :(include_string($code, $fname)))
end

@static if !isdefined(Base, :isabstracttype) # VERSION < v"0.7.0-DEV.3475"
const isabstracttype = Base.isabstract
export isabstracttype
Expand Down
7 changes: 7 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,10 @@ no_specialize_kw2(@nospecialize(x::Integer=0)) = sin(2)
@test no_specialize_kw2(1.0) == sin(1)
@test no_specialize_kw2(1) == sin(2)
@test no_specialize_kw2() == sin(2)

# PR 22064
module Test22064
using Compat
using Compat.Test
@test (@__MODULE__) === Test22064
end
7 changes: 0 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@ for (t, s, m, kept) in [
@test Compat.readuntil(IOBuffer(t), collect(s)::Vector{Char}, keep=true) == Vector{Char}(kept)
end

# PR 22064
module Test22064
using Compat
using Compat.Test
@test (@__MODULE__) === Test22064
end

# invokelatest with keywords
pr22646(x; y=0) = 1
let foo() = begin
Expand Down

0 comments on commit 20b3ff8

Please sign in to comment.