diff --git a/README.md b/README.md index a6646614c..66fe9424a 100644 --- a/README.md +++ b/README.md @@ -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]) @@ -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 diff --git a/src/Compat.jl b/src/Compat.jl index 7317bf70a..3ba7430e4 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index e88d28e71..21f14bd4e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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