Skip to content

Commit

Permalink
Compat.names supporting kwargs for all and imported
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Feb 16, 2018
1 parent a5df998 commit b254e77
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b254e77

Please sign in to comment.