Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add compat annotations for replace on tuples #41746

Merged
merged 1 commit into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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