Skip to content

Commit 58deac9

Browse files
authored
Replace -> with :: where appropriate in docstrings (#57012)
In cases where a function is documented as ``` function(arg::ArgT, arg2::Arg2T) -> RetT ... ``` I either switched ` -> ` to `::` or switched `RetT` to `ret_name::RetT`. From the recommendation and justification from @nsajko here: #56978 (comment) and applied throughout the repo. As documented here #57583 Also includes some minor changes to touched lines (e.g. removing annotations that are just clutter)
1 parent 01798fa commit 58deac9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+480
-480
lines changed

Compiler/src/abstractlattice.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,23 +153,23 @@ function ⊑ end
153153
@nospecializeinfer (::JLTypeLattice, @nospecialize(a::Type), @nospecialize(b::Type)) = a <: b
154154

155155
"""
156-
⊏(𝕃::AbstractLattice, a, b) -> Bool
156+
⊏(𝕃::AbstractLattice, a, b)::Bool
157157
158158
The strict partial order over the type inference lattice.
159159
This is defined as the irreflexive kernel of `⊑`.
160160
"""
161161
@nospecializeinfer (𝕃::AbstractLattice, @nospecialize(a), @nospecialize(b)) = (𝕃, a, b) && !(𝕃, b, a)
162162

163163
"""
164-
⋤(𝕃::AbstractLattice, a, b) -> Bool
164+
⋤(𝕃::AbstractLattice, a, b)::Bool
165165
166166
This order could be used as a slightly more efficient version of the strict order `⊏`,
167167
where we can safely assume `a ⊑ b` holds.
168168
"""
169169
@nospecializeinfer (𝕃::AbstractLattice, @nospecialize(a), @nospecialize(b)) = !(𝕃, b, a)
170170

171171
"""
172-
is_lattice_equal(𝕃::AbstractLattice, a, b) -> Bool
172+
is_lattice_equal(𝕃::AbstractLattice, a, b)::Bool
173173
174174
Check if two lattice elements are partial order equivalent.
175175
This is basically `a ⊑ b && b ⊑ a` in the lattice of `𝕃`
@@ -181,7 +181,7 @@ but (optionally) with extra performance optimizations.
181181
end
182182

183183
"""
184-
has_nontrivial_extended_info(𝕃::AbstractLattice, t) -> Bool
184+
has_nontrivial_extended_info(𝕃::AbstractLattice, t)::Bool
185185
186186
Determines whether the given lattice element `t` of `𝕃` has non-trivial extended lattice
187187
information that would not be available from the type itself.
@@ -204,7 +204,7 @@ end
204204
@nospecializeinfer has_nontrivial_extended_info(::JLTypeLattice, @nospecialize(t)) = false
205205

206206
"""
207-
is_const_prop_profitable_arg(𝕃::AbstractLattice, t) -> Bool
207+
is_const_prop_profitable_arg(𝕃::AbstractLattice, t)::Bool
208208
209209
Determines whether the given lattice element `t` of `𝕃` has new extended lattice information
210210
that should be forwarded along with constant propagation.

Compiler/src/ssair/domtree.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ function rename_nodes!(D::DFSTree, rename_bb::Vector{BBNumber})
595595
end
596596

597597
"""
598-
dominates(domtree::DomTree, bb1::Int, bb2::Int) -> Bool
598+
dominates(domtree::DomTree, bb1::Int, bb2::Int)::Bool
599599
600600
Checks if `bb1` dominates `bb2`.
601601
`bb1` and `bb2` are indexes into the `CFG` blocks.
@@ -606,7 +606,7 @@ dominates(domtree::DomTree, bb1::BBNumber, bb2::BBNumber) =
606606
_dominates(domtree, bb1, bb2)
607607

608608
"""
609-
postdominates(domtree::PostDomTree, bb1::Int, bb2::Int) -> Bool
609+
postdominates(domtree::PostDomTree, bb1::Int, bb2::Int)::Bool
610610
611611
Checks if `bb1` post-dominates `bb2`.
612612
`bb1` and `bb2` are indexes into the `CFG` blocks.

Compiler/src/tfuncs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2597,7 +2597,7 @@ const _EFFECTS_KNOWN_BUILTINS = Any[
25972597
]
25982598

25992599
"""
2600-
builtin_effects(𝕃::AbstractLattice, f::Builtin, argtypes::Vector{Any}, rt) -> Effects
2600+
builtin_effects(𝕃::AbstractLattice, f::Builtin, argtypes::Vector{Any}, rt)::Effects
26012601
26022602
Compute the effects of a builtin function call. `argtypes` should not include `f` itself.
26032603
"""
@@ -2742,7 +2742,7 @@ current_scope_tfunc(interp::AbstractInterpreter, sv) = Any
27422742
hasvarargtype(argtypes::Vector{Any}) = !isempty(argtypes) && isvarargtype(argtypes[end])
27432743

27442744
"""
2745-
builtin_nothrow(𝕃::AbstractLattice, f::Builtin, argtypes::Vector{Any}, rt) -> Bool
2745+
builtin_nothrow(𝕃::AbstractLattice, f::Builtin, argtypes::Vector{Any}, rt)::Bool
27462746
27472747
Compute throw-ness of a builtin function call. `argtypes` should not include `f` itself.
27482748
"""

Compiler/src/types.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ may_compress(::AbstractInterpreter) = true
441441
may_discard_trees(::AbstractInterpreter) = true
442442

443443
"""
444-
method_table(interp::AbstractInterpreter) -> MethodTableView
444+
method_table(interp::AbstractInterpreter)::MethodTableView
445445
446446
Returns a method table this `interp` uses for method lookup.
447447
External `AbstractInterpreter` can optionally return `OverlayMethodTable` here
@@ -519,7 +519,7 @@ add_edges_impl(::Vector{Any}, ::CallInfo) = error("""
519519
All `CallInfo` is required to implement `add_edges_impl(::Vector{Any}, ::CallInfo)`""")
520520
nsplit_impl(::CallInfo) = nothing
521521
getsplit_impl(::CallInfo, ::Int) = error("""
522-
A `info::CallInfo` that implements `nsplit_impl(info::CallInfo) -> Int` must implement `getsplit_impl(info::CallInfo, idx::Int) -> MethodLookupResult`
522+
A `info::CallInfo` that implements `nsplit_impl(info::CallInfo)::Int` must implement `getsplit_impl(info::CallInfo, idx::Int)::MethodLookupResult`
523523
in order to correctly opt in to inlining""")
524524
getresult_impl(::CallInfo, ::Int) = nothing
525525

Compiler/src/typeutils.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function hasuniquerep(@nospecialize t)
2424
end
2525

2626
"""
27-
isTypeDataType(@nospecialize t) -> Bool
27+
isTypeDataType(@nospecialize t)::Bool
2828
2929
For a type `t` test whether ∀S s.t. `isa(S, rewrap_unionall(Type{t}, ...))`,
3030
we have `isa(S, DataType)`. In particular, if a statement is typed as `Type{t}`
@@ -303,7 +303,7 @@ end
303303
const unwraptv = unwraptv_ub
304304

305305
"""
306-
is_identity_free_argtype(argtype) -> Bool
306+
is_identity_free_argtype(argtype)::Bool
307307
308308
Return `true` if the `argtype` object is identity free in the sense that this type or any
309309
reachable through its fields has non-content-based identity (see `Base.isidentityfree`).
@@ -316,7 +316,7 @@ is_identity_free_argtype(@nospecialize ty) = is_identity_free_type(widenconst(ig
316316
is_identity_free_type(@nospecialize ty) = isidentityfree(ty)
317317

318318
"""
319-
is_immutable_argtype(argtype) -> Bool
319+
is_immutable_argtype(argtype)::Bool
320320
321321
Return `true` if the `argtype` object is known to be immutable.
322322
This query is specifically designed for `getfield_effects` and `isdefined_effects`, allowing
@@ -334,7 +334,7 @@ function _is_immutable_type(@nospecialize ty)
334334
end
335335

336336
"""
337-
is_mutation_free_argtype(argtype) -> Bool
337+
is_mutation_free_argtype(argtype)::Bool
338338
339339
Return `true` if `argtype` object is mutation free in the sense that no mutable memory
340340
is reachable from this type (either in the type itself) or through any fields

Compiler/src/utilities.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,14 @@ isa_compileable_sig(m::ABIOverride) = false
174174
has_typevar(@nospecialize(t), v::TypeVar) = ccall(:jl_has_typevar, Cint, (Any, Any), t, v) != 0
175175

176176
"""
177-
is_declared_inline(method::Method) -> Bool
177+
is_declared_inline(method::Method)::Bool
178178
179179
Check if `method` is declared as `@inline`.
180180
"""
181181
is_declared_inline(method::Method) = _is_declared_inline(method, true)
182182

183183
"""
184-
is_declared_noinline(method::Method) -> Bool
184+
is_declared_noinline(method::Method)::Bool
185185
186186
Check if `method` is declared as `@noinline`.
187187
"""
@@ -195,14 +195,14 @@ function _is_declared_inline(method::Method, inline::Bool)
195195
end
196196

197197
"""
198-
is_aggressive_constprop(method::Union{Method,CodeInfo}) -> Bool
198+
is_aggressive_constprop(method::Union{Method,CodeInfo})::Bool
199199
200200
Check if `method` is declared as `Base.@constprop :aggressive`.
201201
"""
202202
is_aggressive_constprop(method::Union{Method,CodeInfo}) = method.constprop == 0x01
203203

204204
"""
205-
is_no_constprop(method::Union{Method,CodeInfo}) -> Bool
205+
is_no_constprop(method::Union{Method,CodeInfo})::Bool
206206
207207
Check if `method` is declared as `Base.@constprop :none`.
208208
"""

base/Base_compiler.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ if false
159159
end
160160

161161
"""
162-
time_ns() -> UInt64
162+
time_ns()::UInt64
163163
164164
Get the time in nanoseconds relative to some arbitrary time in the past. The primary use is for measuring the elapsed time
165165
between two moments in time.

base/abstractarray.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ julia> Base.elsize(rand(Float32, 10))
257257
elsize(A::AbstractArray) = elsize(typeof(A))
258258

259259
"""
260-
ndims(A::AbstractArray) -> Integer
260+
ndims(A::AbstractArray)::Integer
261261
262262
Return the number of dimensions of `A`.
263263
@@ -276,7 +276,7 @@ ndims(::Type{<:AbstractArray{<:Any,N}}) where {N} = N::Int
276276
ndims(::Type{Union{}}, slurp...) = throw(ArgumentError("Union{} does not have elements"))
277277

278278
"""
279-
length(collection) -> Integer
279+
length(collection)::Integer
280280
281281
Return the number of elements in the collection.
282282
@@ -404,8 +404,8 @@ _all_match_first(f::F, inds) where F<:Function = true
404404
keys(s::IndexStyle, A::AbstractArray, B::AbstractArray...) = eachindex(s, A, B...)
405405

406406
"""
407-
lastindex(collection) -> Integer
408-
lastindex(collection, d) -> Integer
407+
lastindex(collection)::Integer
408+
lastindex(collection, d)::Integer
409409
410410
Return the last index of `collection`. If `d` is given, return the last index of `collection` along dimension `d`.
411411
@@ -427,8 +427,8 @@ lastindex(a::AbstractArray) = (@inline; last(eachindex(IndexLinear(), a)))
427427
lastindex(a, d) = (@inline; last(axes(a, d)))
428428

429429
"""
430-
firstindex(collection) -> Integer
431-
firstindex(collection, d) -> Integer
430+
firstindex(collection)::Integer
431+
firstindex(collection, d)::Integer
432432
433433
Return the first index of `collection`. If `d` is given, return the first index of `collection` along dimension `d`.
434434
@@ -3147,7 +3147,7 @@ end
31473147
## iteration utilities ##
31483148

31493149
"""
3150-
foreach(f, c...) -> Nothing
3150+
foreach(f, c...) -> nothing
31513151
31523152
Call function `f` on each element of iterable `c`.
31533153
For multiple iterable arguments, `f` is called elementwise, and iteration stops when

base/abstractarraymath.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ isreal(x::AbstractArray{<:Real}) = true
99
## Constructors ##
1010

1111
"""
12-
vec(a::AbstractArray) -> AbstractVector
12+
vec(a::AbstractArray)::AbstractVector
1313
1414
Reshape the array `a` as a one-dimensional column vector. Return `a` if it is
1515
already an `AbstractVector`. The resulting array

base/abstractset.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,9 @@ end
302302
const = issubset
303303
function end
304304
"""
305-
issubset(a, b) -> Bool
306-
⊆(a, b) -> Bool
307-
⊇(b, a) -> Bool
305+
issubset(a, b)::Bool
306+
⊆(a, b)::Bool
307+
⊇(b, a)::Bool
308308
309309
Determine whether every element of `a` is also in `b`, using [`in`](@ref).
310310
@@ -394,8 +394,8 @@ used to implement specialized methods.
394394
function end
395395
function end
396396
"""
397-
⊊(a, b) -> Bool
398-
⊋(b, a) -> Bool
397+
⊊(a, b)::Bool
398+
⊋(b, a)::Bool
399399
400400
Determines if `a` is a subset of, but not equal to, `b`.
401401
@@ -446,8 +446,8 @@ used to implement specialized methods.
446446
function end
447447
function end
448448
"""
449-
⊈(a, b) -> Bool
450-
⊉(b, a) -> Bool
449+
⊈(a, b)::Bool
450+
⊉(b, a)::Bool
451451
452452
Negation of `⊆` and `⊇`, i.e. checks that `a` is not a subset of `b`.
453453
@@ -496,7 +496,7 @@ used to implement specialized methods.
496496
## set equality comparison
497497

498498
"""
499-
issetequal(a, b) -> Bool
499+
issetequal(a, b)::Bool
500500
501501
Determine whether `a` and `b` have the same elements. Equivalent
502502
to `a ⊆ b && b ⊆ a` but more efficient when possible.
@@ -544,7 +544,7 @@ issetequal(a) = Fix2(issetequal, a)
544544

545545
## set disjoint comparison
546546
"""
547-
isdisjoint(a, b) -> Bool
547+
isdisjoint(a, b)::Bool
548548
549549
Determine whether the collections `a` and `b` are disjoint.
550550
Equivalent to `isempty(a ∩ b)` but more efficient when possible.

0 commit comments

Comments
 (0)