Skip to content

Commit

Permalink
Drop compat code for parentmodule from #461
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Oct 8, 2019
1 parent a118921 commit b3f3d74
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ Currently, the `@compat` macro supports the following syntaxes:

* `reprmime(mime, x)` is now `repr(mime, x)` ([#25990]) and `mimewritable` is now `showable` ([#26089]).

* `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]).

Expand Down
9 changes: 0 additions & 9 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ end
end
end

@static if !isdefined(Base, :parentmodule)
parentmodule(m::Module) = Base.module_parent(m)
parentmodule(f::Function) = Base.function_module(f)
parentmodule(@nospecialize(f), @nospecialize(t)) = Base.function_module(f, t)
parentmodule(t::DataType) = Base.datatype_module(t)
parentmodule(t::UnionAll) = Base.datatype_module(Base.unwrap_unionall(t))
export parentmodule
end

@static if !isdefined(Base, :codeunits)
codeunits(s::String) = Vector{UInt8}(s)
ncodeunits(s::Union{String,SubString{String}}) = sizeof(s)
Expand Down
7 changes: 7 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -654,3 +654,10 @@ end
@test argmin([10 12; 9 11]) == CartesianIndex(2, 1)
@test argmin(Dict(:z=>10, :y=>12, :x=>9, :w=>11)) == :x
@test argmin((1.0, -3, 0.f0)) == 2

# 0.7.0-DEV.3460
@test parentmodule(Compat.Sys) == Compat
@test parentmodule(sin) == Base
@test parentmodule(sin, Tuple{Int}) == Base.Math
@test parentmodule(Int) == Core
@test parentmodule(Array) == Core
7 changes: 0 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ let A = [1]
@test x == 1
end

# 0.7.0-DEV.3460
@test parentmodule(Compat.Sys) == Compat
@test parentmodule(sin) == Base
@test parentmodule(sin, Tuple{Int}) == Base.Math
@test parentmodule(Int) == Core
@test parentmodule(Array) == Core

@test codeunits("foo") == [0x66,0x6f,0x6f] == codeunits(SubString("fooαβγ",1,3))
@test ncodeunits("αβγ") == 6 == ncodeunits(SubString("fooαβγ",4,8))
@test codeunit("foo") == codeunit(SubString("fooαβγ",1,3)) == UInt8
Expand Down

0 comments on commit b3f3d74

Please sign in to comment.