From c9a1767f1adab78268f77fb0a8fe3b48885eb495 Mon Sep 17 00:00:00 2001 From: Rafael Fourquet Date: Fri, 20 Mar 2020 22:26:35 +0100 Subject: [PATCH] add compat annotation for map!(f, values(dict)) (from #31223) (#35184) --- HISTORY.md | 1 + base/abstractdict.jl | 3 +++ 2 files changed, 4 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index 7e4fa12b639dd..1185848a2a7cd 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -340,6 +340,7 @@ New library functions * Added `Base.hasproperty` and `Base.hasfield` ([#28850]). * One argument `!=(x)`, `>(x)`, `>=(x)`, `<(x)`, `<=(x)` have been added, returning partially-applied versions of the functions, similar to the existing `==(x)` and `isequal(x)` methods ([#30915]). +* The new `map!(f, values(::AbstractDict))` method allows to modify in-place values of a dictionary ([#31223]). Standard library changes ------------------------ diff --git a/base/abstractdict.jl b/base/abstractdict.jl index 76627d4475699..514bf53b7db6f 100644 --- a/base/abstractdict.jl +++ b/base/abstractdict.jl @@ -560,6 +560,9 @@ Modifies `dict` by transforming each value from `val` to `f(val)`. Note that the type of `dict` cannot be changed: if `f(val)` is not an instance of the value type of `dict` then it will be converted to the value type if possible and otherwise raise an error. +!!! compat "Julia 1.2" + `map!(f, values(dict::AbstractDict))` requires Julia 1.2 or later. + # Examples ```jldoctest julia> d = Dict(:a => 1, :b => 2)