diff --git a/README.md b/README.md index de8f4b681..02a611d57 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/src/Compat.jl b/src/Compat.jl index 6bf19888b..e31d15934 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index b3287a06a..3e1ee6cd4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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)