Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Compat.Pkg and Compat.InteractiveUtils #485

Merged
merged 1 commit into from
Feb 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -526,4 +532,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