Skip to content
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ Currently, the `@compat` macro supports the following syntaxes:
* `module_parent`, `Base.function_module`, and `Base.datatype_module` are now methods of
a new function called `parentmodule` ([#25629]).

* `module_name`, `Base.function_name`, and `Base.datatype_name` are now methods of a
new function called `nameof` ([#25622]).

* `find` is now `findall` ([#25545]).

* `indmin` and `indmax` are now `argmin` and `argmax`, respectively ([#25654]).
Expand Down Expand Up @@ -499,6 +502,7 @@ includes this fix. Find the minimum version from there.
[#25544]: https://github.com/JuliaLang/julia/issues/25544
[#25545]: https://github.com/JuliaLang/julia/issues/25545
[#25571]: https://github.com/JuliaLang/julia/issues/25571
[#25622]: https://github.com/JuliaLang/julia/issues/25622
[#25628]: https://github.com/JuliaLang/julia/issues/25628
[#25629]: https://github.com/JuliaLang/julia/issues/25629
[#25654]: https://github.com/JuliaLang/julia/issues/25654
Expand Down
7 changes: 7 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,13 @@ end
export codeunits, ncodeunits
end

@static if !isdefined(Base, :nameof)
nameof(m::Module) = Base.module_name(m)
nameof(f::Function) = Base.function_name(f)
nameof(t::Union{DataType,UnionAll}) = Base.datatype_name(t)
export nameof
end

include("deprecated.jl")

end # module Compat
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,12 @@ end
@test codeunits("foo") == [0x66,0x6f,0x6f] == codeunits(SubString("fooαβγ",1,3))
@test ncodeunits("αβγ") == 6 == ncodeunits(SubString("fooαβγ",4,8))

# 0.7.0-DEV.3539
@test nameof(Compat.Sys) == :Sys
@test nameof(sin) == :sin
@test nameof(Float64) == :Float64
@test nameof(Array) == :Array

# 0.7.0-DEV.3382
module TestLibdl
using Compat
Expand Down