Skip to content

Commit

Permalink
Add pushfirst! and popfirst! (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan authored and fredrikekre committed Jan 3, 2018
1 parent 423a025 commit 7a92e17
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ Currently, the `@compat` macro supports the following syntaxes:

* `Void` is now `Nothing` with an alias `Cvoid` for C interop ([#25162]).

* `unshift!` and `shift!` are now `pushfirst!` and `popfirst!` ([#25100]).

## New macros

* `@__DIR__` has been added ([#18380])
Expand Down Expand Up @@ -419,5 +421,6 @@ includes this fix. Find the minimum version from there.
[#25021]: https://github.com/JuliaLang/julia/issues/25021
[#25056]: https://github.com/JuliaLang/julia/issues/25056
[#25057]: https://github.com/JuliaLang/julia/issues/25057
[#25100]: https://github.com/JuliaLang/julia/issues/25100
[#25102]: https://github.com/JuliaLang/julia/issues/25102
[#25162]: https://github.com/JuliaLang/julia/issues/25162
7 changes: 7 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,13 @@ else
import Base: notnothing
end

# 0.7.0-DEV.3155
@static if !isdefined(Base, :pushfirst!)
const pushfirst! = unshift!
const popfirst! = shift!
export pushfirst!, popfirst!
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 @@ -1063,6 +1063,12 @@ end
@test Compat.notnothing(1) == 1
@test_throws ArgumentError Compat.notnothing(nothing)

# 0.7.0-DEV.3155
let coolvec = [1,2,3]
@test pushfirst!(coolvec, 0) == [0,1,2,3]
@test popfirst!(coolvec) == 0
end

if VERSION < v"0.6.0"
include("deprecated.jl")
end
Expand Down

0 comments on commit 7a92e17

Please sign in to comment.