Skip to content

Commit 70cc57c

Browse files
authored
Add/improve some compat admonitions (#42179)
1 parent ace60cf commit 70cc57c

File tree

7 files changed

+36
-10
lines changed

7 files changed

+36
-10
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::Task=current_task(); backtrace::Bool=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
@@ -995,7 +995,7 @@ julia> f.value
995995
```
996996
997997
!!! compat "Julia 1.7"
998-
Returns requires at least Julia 1.7.
998+
`Returns` requires at least Julia 1.7.
999999
"""
10001000
struct Returns{V} <: Function
10011001
value::V

base/reflection.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,9 @@ Provides a convenient way to call [`invoke`](@ref);
16831683
`@invoke f(arg1::T1, arg2::T2; kwargs...)` will be expanded into `invoke(f, Tuple{T1,T2}, arg1, arg2; kwargs...)`.
16841684
When an argument's type annotation is omitted, it's specified as `Any` argument, e.g.
16851685
`@invoke f(arg1::T, arg2)` will be expanded into `invoke(f, Tuple{T,Any}, arg1, arg2)`.
1686+
1687+
!!! compat "Julia 1.7"
1688+
This macro requires Julia 1.7 or later.
16861689
"""
16871690
macro invoke(ex)
16881691
f, args, kwargs = destructure_callex(ex)
@@ -1699,6 +1702,9 @@ end
16991702
Provides a convenient way to call [`Base.invokelatest`](@ref).
17001703
`@invokelatest f(args...; kwargs...)` will simply be expanded into
17011704
`Base.invokelatest(f, args...; kwargs...)`.
1705+
1706+
!!! compat "Julia 1.7"
1707+
This macro requires Julia 1.7 or later.
17021708
"""
17031709
macro invokelatest(ex)
17041710
f, args, kwargs = destructure_callex(ex)

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
@@ -690,9 +690,9 @@ The length of `itr` must be even, and the returned array has half of the length
690690
See also [`hex2bytes!`](@ref) for an in-place version, and [`bytes2hex`](@ref) for the inverse.
691691
692692
!!! compat "Julia 1.7"
693-
Calling hex2bytes with iterables producing UInt8 requires
694-
version 1.7. In earlier versions, you can collect the iterable
695-
before calling instead.
693+
Calling `hex2bytes` with iterators producing `UInt8` values requires
694+
Julia 1.7 or later. In earlier versions, you can `collect` the iterator
695+
before calling `hex2bytes`.
696696
697697
# Examples
698698
```jldoctest
@@ -777,9 +777,9 @@ returning a `String` via `bytes2hex(itr)` or writing the string to an `io` strea
777777
via `bytes2hex(io, itr)`. The hexadecimal characters are all lowercase.
778778
779779
!!! compat "Julia 1.7"
780-
Calling bytes2hex with iterators producing UInt8 requires
781-
version 1.7. In earlier versions, you can collect the iterable
782-
before calling instead.
780+
Calling `bytes2hex` with arbitrary iterators producing `UInt8` values requires
781+
Julia 1.7 or later. In earlier versions, you can `collect` the iterator
782+
before calling `bytes2hex`.
783783
784784
# Examples
785785
```jldoctest

0 commit comments

Comments
 (0)