Skip to content

Commit

Permalink
Drop compat code for firstindex and lastindex from #480 and #494
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Oct 8, 2019
1 parent cd9a04d commit 8b5ea33
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 23 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ Currently, the `@compat` macro supports the following syntaxes:

* `printstyled` prints to a given stream optionally in color and/or bolded ([#25522]).

* `firstindex` to obtain the first index of an iterable ([#25458]).

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

* `Compat.IOBuffer` supporting keyword arguments ([#25873]).
Expand Down Expand Up @@ -140,8 +138,6 @@ Currently, the `@compat` macro supports the following syntaxes:
for entries with no match and gives the index of the first (rather than the last) match
([#25662], [#25998]).

* `endof` is now `lastindex` ([#25458]). (Note that `lastindex(A, n)` is not supported.)

* `method_exists` is now `hasmethod` ([#25615]).

* `object_id` is now `objectid` ([#25615]).
Expand Down
14 changes: 0 additions & 14 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,6 @@ end
end
end

# 0.7.0-DEV.3583
@static if !isdefined(Base, :lastindex)
const lastindex = endof
export lastindex
firstindex(a::AbstractArray) = (Base.@_inline_meta; first(linearindices(a)))
firstindex(c::Char) = 1
firstindex(c::Number) = 1
firstindex(p::Pair) = 1
firstindex(cmd::Cmd) = firstindex(cmd.exec)
firstindex(s::AbstractString) = 1
firstindex(t::Tuple) = 1
export firstindex
end

# 0.7.0-DEV.3585
@static if !isdefined(Base, :printstyled)
printstyled(io::IO, msg...; bold=false, color=:normal) =
Expand Down
5 changes: 5 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -709,3 +709,8 @@ let b = IOBuffer()
write(b, "hi")
@test bytesavailable(b) == 0
end

# 0.7.0-DEV.3583
@test lastindex(zeros(4)) == 4
@test lastindex(zeros(4,4)) == 16
@test all(x -> firstindex(x) == 1, ([1, 2], [1 2; 3 4], 'a', 1, 1=>2, `foo`, "foo", (1, 2)))
5 changes: 0 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ end

@test codeunit("foo") == codeunit(SubString("fooαβγ",1,3)) == UInt8

# 0.7.0-DEV.3583
@test lastindex(zeros(4)) == 4
@test lastindex(zeros(4,4)) == 16
@test all(x -> firstindex(x) == 1, ([1, 2], [1 2; 3 4], 'a', 1, 1=>2, `foo`, "foo", (1, 2)))

# 0.7.0-DEV.3585
let buf = IOBuffer()
if VERSION < v"0.7.0-DEV.3077"
Expand Down

0 comments on commit 8b5ea33

Please sign in to comment.