Skip to content

Commit

Permalink
names with kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Feb 16, 2018
1 parent 083c291 commit 98952df
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ Currently, the `@compat` macro supports the following syntaxes:

* `Dates.Period` rounding (e.g., `round(Dates.Hour(36), Dates.Day, RoundNearestTiesUp) == Dates.Day(2)` ([#24182]).

* `names` with keyword arguments for `all` and `imported` ([#25647]).


## Renaming

Expand Down
5 changes: 5 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,11 @@ 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"
Base.names(m; all=true, imported=true) = names(m, all, imported)
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 @@ -1408,4 +1408,12 @@ module TestUUIDs
@test uuid4() isa UUID
end

# 0.7.0-DEV.3526
module TestNames
export foo
function bar end
end
@test :foo in names(TestNames)
@test :bar in names(TestNames, all=true)

nothing

0 comments on commit 98952df

Please sign in to comment.