Skip to content

Commit 3fa2d26

Browse files
sostockKristofferC
authored andcommitted
Add/improve some compat admonitions (#42179)
(cherry picked from commit 70cc57c)
1 parent 5db2802 commit 3fa2d26

File tree

7 files changed

+36
-12
lines changed

7 files changed

+36
-12
lines changed

base/error.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ arbitrary task. This is useful for inspecting tasks which have failed due to
142142
uncaught exceptions.
143143
144144
!!! compat "Julia 1.7"
145-
This function went by the experiemental name `catch_stack()` in Julia
145+
This function went by the experimental name `catch_stack()` in Julia
146146
1.1–1.6, and had a plain Vector-of-tuples as a return type.
147147
"""
148148
function current_exceptions(task=current_task(); backtrace=true)

base/int.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ inv(x::Integer) = float(one(x)) / float(x)
9797
9898
Return `true` if `x` is an odd integer (that is, an integer not divisible by 2), and `false` otherwise.
9999
100+
!!! compat "Julia 1.7"
101+
Non-`Integer` arguments require Julia 1.7 or later.
102+
100103
# Examples
101104
```jldoctest
102105
julia> isodd(9)
@@ -114,6 +117,9 @@ isodd(n::Real) = isinteger(n) && !iszero(rem(Integer(n), 2))
114117
115118
Return `true` if `x` is an even integer (that is, an integer divisible by 2), and `false` otherwise.
116119
120+
!!! compat "Julia 1.7"
121+
Non-`Integer` arguments require Julia 1.7 or later.
122+
117123
# Examples
118124
```jldoctest
119125
julia> iseven(9)

base/lock.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ available.
180180
181181
When this function returns, the `lock` has been released, so the caller should
182182
not attempt to `unlock` it.
183+
184+
!!! compat "Julia 1.7"
185+
Using a [`Channel`](@ref) as the second argument requires Julia 1.7 or later.
183186
"""
184187
function lock(f, l::AbstractLock)
185188
lock(l)

base/operators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ julia> f.value
986986
```
987987
988988
!!! compat "Julia 1.7"
989-
Returns requires at least Julia 1.7.
989+
`Returns` requires at least Julia 1.7.
990990
"""
991991
struct Returns{V} <: Function
992992
value::V

base/special/trig.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,11 @@ for (fd, f, fn) in ((:sind, :sin, "sine"), (:cosd, :cos, "cosine"), (:tand, :tan
12681268
$($name)(x)
12691269
12701270
Compute $($fn) of `x`, where `x` is in $($un).
1271-
If `x` is a matrix, `x` needs to be a square matrix. """ ($fd)(x) = ($f)(($fu).(x))
1271+
If `x` is a matrix, `x` needs to be a square matrix.
1272+
1273+
!!! compat "Julia 1.7"
1274+
Matrix arguments require Julia 1.7 or later.
1275+
""" ($fd)(x) = ($f)(($fu).(x))
12721276
end
12731277
end
12741278
end
@@ -1283,7 +1287,11 @@ for (fd, f, fn) in ((:asind, :asin, "sine"), (:acosd, :acos, "cosine"),
12831287
$($name)(x)
12841288
12851289
Compute the inverse $($fn) of `x`, where the output is in $($un).
1286-
If `x` is a matrix, `x` needs to be a square matrix. """ ($fd)(x) = ($fu).(($f)(x))
1290+
If `x` is a matrix, `x` needs to be a square matrix.
1291+
1292+
!!! compat "Julia 1.7"
1293+
Matrix arguments require Julia 1.7 or later.
1294+
""" ($fd)(x) = ($fu).(($f)(x))
12871295
end
12881296
end
12891297
end
@@ -1293,6 +1301,9 @@ end
12931301
atand(y,x)
12941302
12951303
Compute the inverse tangent of `y` or `y/x`, respectively, where the output is in degrees.
1304+
1305+
!!! compat "Julia 1.7"
1306+
The one-argument method supports square matrix arguments as of Julia 1.7.
12961307
"""
12971308
atand(y) = rad2deg.(atan(y))
12981309
atand(y, x) = rad2deg.(atan(y,x))

base/strings/util.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -649,9 +649,9 @@ The length of `itr` must be even, and the returned array has half of the length
649649
See also [`hex2bytes!`](@ref) for an in-place version, and [`bytes2hex`](@ref) for the inverse.
650650
651651
!!! compat "Julia 1.7"
652-
Calling hex2bytes with iterables producing UInt8 requires
653-
version 1.7. In earlier versions, you can collect the iterable
654-
before calling instead.
652+
Calling `hex2bytes` with iterators producing `UInt8` values requires
653+
Julia 1.7 or later. In earlier versions, you can `collect` the iterator
654+
before calling `hex2bytes`.
655655
656656
# Examples
657657
```jldoctest
@@ -736,9 +736,9 @@ returning a `String` via `bytes2hex(itr)` or writing the string to an `io` strea
736736
via `bytes2hex(io, itr)`. The hexadecimal characters are all lowercase.
737737
738738
!!! compat "Julia 1.7"
739-
Calling bytes2hex with iterators producing UInt8 requires
740-
version 1.7. In earlier versions, you can collect the iterable
741-
before calling instead.
739+
Calling `bytes2hex` with arbitrary iterators producing `UInt8` values requires
740+
Julia 1.7 or later. In earlier versions, you can `collect` the iterator
741+
before calling `bytes2hex`.
742742
743743
# Examples
744744
```jldoctest

base/util.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,11 +541,13 @@ end
541541

542542
"""
543543
@invoke f(arg::T, ...; kwargs...)
544-
545544
Provides a convenient way to call [`invoke`](@ref);
546545
`@invoke f(arg1::T1, arg2::T2; kwargs...)` will be expanded into `invoke(f, Tuple{T1,T2}, arg1, arg2; kwargs...)`.
547546
When an argument's type annotation is omitted, it's specified as `Any` argument, e.g.
548547
`@invoke f(arg1::T, arg2)` will be expanded into `invoke(f, Tuple{T,Any}, arg1, arg2)`.
548+
549+
!!! compat "Julia 1.7"
550+
This macro requires Julia 1.7 or later.
549551
"""
550552
macro invoke(ex)
551553
f, args, kwargs = destructure_callex(ex)
@@ -558,10 +560,12 @@ end
558560

559561
"""
560562
@invokelatest f(args...; kwargs...)
561-
562563
Provides a convenient way to call [`Base.invokelatest`](@ref).
563564
`@invokelatest f(args...; kwargs...)` will simply be expanded into
564565
`Base.invokelatest(f, args...; kwargs...)`.
566+
567+
!!! compat "Julia 1.7"
568+
This macro requires Julia 1.7 or later.
565569
"""
566570
macro invokelatest(ex)
567571
f, args, kwargs = destructure_callex(ex)

0 commit comments

Comments
 (0)