Skip to content

Commit

Permalink
Add Compat.Pkg and Compat.InteractiveUtils (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Feb 3, 2018
1 parent 02367e6 commit f008a07
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ Currently, the `@compat` macro supports the following syntaxes:
* `using Compat.Distributed` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#24443]).

* `using Compat.Pkg` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#25705]).

* `using Compat.InteractiveUtils` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#25780]).

## New functions, macros, and methods

* `@views` takes an expression and converts all slices to views ([#20164]), while
Expand Down Expand Up @@ -531,4 +537,6 @@ includes this fix. Find the minimum version from there.
[#25634]: https://github.com/JuliaLang/julia/issues/25634
[#25646]: https://github.com/JuliaLang/julia/issues/25646
[#25654]: https://github.com/JuliaLang/julia/issues/25654
[#25705]: https://github.com/JuliaLang/julia/issues/25705
[#25780]: https://github.com/JuliaLang/julia/issues/25780
[#24182]: https://github.com/JuliaLang/julia/issues/24182
29 changes: 29 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,35 @@ else
import Distributed
end

@static if VERSION < v"0.7.0-DEV.3656"
const Pkg = Base.Pkg
else
import Pkg
end

@static if VERSION < v"0.7.0-DEV.3630"
@eval module InteractiveUtils
using Base: @code_llvm, @code_lowered, @code_native, @code_typed,
@code_warntype, @edit, @functionloc, @less, @which,
apropos, code_llvm, code_native, code_warntype, edit,
less, methodswith, subtypes, versioninfo
export @code_llvm, @code_lowered, @code_native, @code_typed,
@code_warntype, @edit, @functionloc, @less, @which,
apropos, code_llvm, code_native, code_warntype, edit,
less, methodswith, subtypes, versioninfo

@static if VERSION >= v"0.7.0-DEV.2582"
using Base: varinfo
export varinfo
else
const varinfo = whos
export varinfo
end
end
else
import InteractiveUtils
end

# 0.7.0-DEV.2695
@static if !isdefined(Base, :AbstractDisplay)
const AbstractDisplay = Display
Expand Down
16 changes: 16 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,22 @@ module TestSerialization
@test isdefined(@__MODULE__, :SerializationState)
end

module TestPkg
using Compat
using Compat.Pkg
using Compat.Test
@test isdefined(@__MODULE__, :Pkg)
@test isdefined(@__MODULE__, :add)
end

module TestInteractiveUtils
using Compat
using Compat.InteractiveUtils
using Compat.Test
@test isdefined(@__MODULE__, :InteractiveUtils)
@test isdefined(@__MODULE__, :varinfo)
end

# 0.7.0-DEV.3469
@test GC.enable(true)
@test GC.enable(false)
Expand Down

0 comments on commit f008a07

Please sign in to comment.