From f526085ace873250e4ba39acf32d556b5622484b Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Fri, 16 Feb 2018 11:54:09 +0100 Subject: [PATCH] Compat.names supporting kwargs for all and imported --- README.md | 9 +++++++-- src/Compat.jl | 7 +++++++ test/runtests.jl | 8 ++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2e8cc445b..ac573a2b5 100644 --- a/README.md +++ b/README.md @@ -274,6 +274,8 @@ Currently, the `@compat` macro supports the following syntaxes: * `firstindex` to obtain the first index of an iterable ([#25458]). +* `Compat.names` supporting keyword arguments for `all` and `imported` ([#25647]). + ## Renaming @@ -511,6 +513,7 @@ includes this fix. Find the minimum version from there. [#23812]: https://github.com/JuliaLang/julia/issues/23812 [#23931]: https://github.com/JuliaLang/julia/issues/23931 [#24047]: https://github.com/JuliaLang/julia/issues/24047 +[#24182]: https://github.com/JuliaLang/julia/issues/24182 [#24282]: https://github.com/JuliaLang/julia/issues/24282 [#24361]: https://github.com/JuliaLang/julia/issues/24361 [#24372]: https://github.com/JuliaLang/julia/issues/24372 @@ -526,6 +529,7 @@ includes this fix. Find the minimum version from there. [#24714]: https://github.com/JuliaLang/julia/issues/24714 [#24785]: https://github.com/JuliaLang/julia/issues/24785 [#24808]: https://github.com/JuliaLang/julia/issues/24808 +[#24831]: https://github.com/JuliaLang/julia/issues/24831 [#24874]: https://github.com/JuliaLang/julia/issues/24874 [#25012]: https://github.com/JuliaLang/julia/issues/25012 [#25021]: https://github.com/JuliaLang/julia/issues/25021 @@ -555,9 +559,10 @@ includes this fix. Find the minimum version from there. [#25629]: https://github.com/JuliaLang/julia/issues/25629 [#25634]: https://github.com/JuliaLang/julia/issues/25634 [#25646]: https://github.com/JuliaLang/julia/issues/25646 +[#25647]: https://github.com/JuliaLang/julia/issues/25647 [#25654]: https://github.com/JuliaLang/julia/issues/25654 [#25705]: https://github.com/JuliaLang/julia/issues/25705 [#25706]: https://github.com/JuliaLang/julia/issues/25706 +[#25738]: https://github.com/JuliaLang/julia/issues/25738 [#25780]: https://github.com/JuliaLang/julia/issues/25780 -[#24182]: https://github.com/JuliaLang/julia/issues/24182 -[#24673]: https://github.com/JuliaLang/julia/issues/24673 +[#25819]: https://github.com/JuliaLang/julia/issues/25819 diff --git a/src/Compat.jl b/src/Compat.jl index 3fd5d2f95..0bfe9eb39 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -1643,6 +1643,13 @@ else findall(b::OccursIn, a::Number) = a in b.x ? [1] : Vector{Int}() end +# https://github.com/JuliaLang/julia/pull/25647 +@static if VERSION < v"0.7.0-DEV.3526" + names(m; all=true, imported=true) = Base.names(m, all, imported) +else + import Base: names +end + if VERSION >= v"0.7.0-DEV.3666" import UUIDs else diff --git a/test/runtests.jl b/test/runtests.jl index a2cd3b559..23995bfaa 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1413,4 +1413,12 @@ end import Compat.Markdown @test isa(Markdown.parse("foo"), Markdown.MD) +# 0.7.0-DEV.3526 +module TestNames + export foo + function bar end +end +@test :foo in Compat.names(TestNames) +@test :bar in Compat.names(TestNames, all=true) + nothing