Skip to content

Commit e725653

Browse files
ivarnebicycle1885
authored andcommitted
Fix #9295
Deprecate `push!(a, k, v)` in favor of `push!(a, k=>v)` because the old signature was inconsistent with the varargs version of `push!` to add multiple elements to a collection. TODO: Add tests Conflicts: base/deprecated.jl
1 parent 4ff8145 commit e725653

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

base/deprecated.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,3 +276,6 @@ const base64 = base64encode
276276

277277
@deprecate map!(f::Callable, dest::StridedArray, A::StridedArray, B::Number) broadcast!(f, dest, A, B)
278278
@deprecate map!(f::Callable, dest::StridedArray, A::Number, B::StridedArray) broadcast!(f, dest, A, B)
279+
280+
#9295
281+
@deprecate push!(t::Associative, key, v) setindex!(t, v, key)

base/dict.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ end
246246
getindex(t::Associative, k1, k2, ks...) = getindex(t, tuple(k1,k2,ks...))
247247
setindex!(t::Associative, v, k1, k2, ks...) = setindex!(t, v, tuple(k1,k2,ks...))
248248

249-
push!(t::Associative, key, v) = setindex!(t, v, key)
249+
push!(t::Associative, p::Pair) = setindex!(t, p.second, p.first)
250250

251251
# hashing objects by identity
252252

0 commit comments

Comments
 (0)