Skip to content

Commit

Permalink
add compat annotations for replace on tuples
Browse files Browse the repository at this point in the history
The methods were added in #38216.
  • Loading branch information
rfourquet committed Aug 13, 2021
1 parent 712b801 commit f7a65ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Standard library changes
overflow in most cases. The new function `checked_length` is now available, which will try to use checked
arithmetic to error if the result may be wrapping. Or use a package such as SaferIntegers.jl when
constructing the range. ([#40382])
* New `replace` methods to replace elements of a `Tuple` ([#38216]).

#### Package Manager

Expand Down Expand Up @@ -316,6 +317,7 @@ Tooling Improvements
[#37971]: https://github.com/JuliaLang/julia/issues/37971
[#37978]: https://github.com/JuliaLang/julia/issues/37978
[#38041]: https://github.com/JuliaLang/julia/issues/38041
[#38216]: https://github.com/JuliaLang/julia/issues/38216
[#38379]: https://github.com/JuliaLang/julia/issues/38379
[#38438]: https://github.com/JuliaLang/julia/issues/38438
[#38574]: https://github.com/JuliaLang/julia/issues/38574
Expand Down
6 changes: 6 additions & 0 deletions base/set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,9 @@ replaced.
See also [`replace!`](@ref), [`splice!`](@ref), [`delete!`](@ref), [`insert!`](@ref).
!!! compat "Julia 1.7"
Version 1.7 is required to replace elements of a `Tuple`.
# Examples
```jldoctest
julia> replace([1, 2, 1, 3], 1=>0, 2=>4, count=2)
Expand Down Expand Up @@ -596,6 +599,9 @@ Return a copy of `A` where each value `x` in `A` is replaced by `new(x)`.
If `count` is specified, then replace at most `count` values in total
(replacements being defined as `new(x) !== x`).
!!! compat "Julia 1.7"
Version 1.7 is required to replace elements of a `Tuple`.
# Examples
```jldoctest
julia> replace(x -> isodd(x) ? 2x : x, [1, 2, 3, 4])
Expand Down

0 comments on commit f7a65ee

Please sign in to comment.