Skip to content

Commit

Permalink
Drop compat code for codeunits from #474
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Oct 8, 2019
1 parent b3f3d74 commit fe1f159
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ Currently, the `@compat` macro supports the following syntaxes:
* `@compat finalizer(func, obj)` with the finalizer to run as the first argument and the object to be finalized
as the second ([#24605]).

* `codeunits(s)` returns an array-like view of the `UInt8` code units of
a string and `ncodeunits(s)` returns the number of code units ([#25241]).
`codeunit(s)` returns the type of the code units of `s` ([#24999]).
* `codeunit(s)` returns the type of the code units of `s` ([#24999]).

* `thisind(s, i)` returns the character index for codeunit `i` ([#24414]).

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

@static if !isdefined(Base, :codeunits)
codeunits(s::String) = Vector{UInt8}(s)
ncodeunits(s::Union{String,SubString{String}}) = sizeof(s)
codeunits(s::SubString{String}) = view(codeunits(s.string),1+s.offset:s.offset+sizeof(s))
export codeunits, ncodeunits
end

@static if !isdefined(Base, :nameof)
nameof(m::Module) = Base.module_name(m)
nameof(f::Function) = Base.function_name(f)
Expand Down
3 changes: 3 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -661,3 +661,6 @@ end
@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))
2 changes: 0 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ let A = [1]
@test x == 1
end

@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

# 0.7.0-DEV.3539
Expand Down

0 comments on commit fe1f159

Please sign in to comment.