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

Replace -> with :: where appropriate in docstrings #57012

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions Compiler/src/abstractlattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,23 +153,23 @@ function ⊑ end
@nospecializeinfer ⊑(::JLTypeLattice, @nospecialize(a::Type), @nospecialize(b::Type)) = a <: b

"""
⊏(𝕃::AbstractLattice, a, b) -> Bool
⊏(𝕃::AbstractLattice, a, b)::Bool

The strict partial order over the type inference lattice.
This is defined as the irreflexive kernel of `⊑`.
"""
@nospecializeinfer ⊏(𝕃::AbstractLattice, @nospecialize(a), @nospecialize(b)) = ⊑(𝕃, a, b) && !⊑(𝕃, b, a)

"""
⋤(𝕃::AbstractLattice, a, b) -> Bool
⋤(𝕃::AbstractLattice, a, b)::Bool

This order could be used as a slightly more efficient version of the strict order `⊏`,
where we can safely assume `a ⊑ b` holds.
"""
@nospecializeinfer ⋤(𝕃::AbstractLattice, @nospecialize(a), @nospecialize(b)) = !⊑(𝕃, b, a)

"""
is_lattice_equal(𝕃::AbstractLattice, a, b) -> Bool
is_lattice_equal(𝕃::AbstractLattice, a, b)::Bool

Check if two lattice elements are partial order equivalent.
This is basically `a ⊑ b && b ⊑ a` in the lattice of `𝕃`
Expand All @@ -181,7 +181,7 @@ but (optionally) with extra performance optimizations.
end

"""
has_nontrivial_extended_info(𝕃::AbstractLattice, t) -> Bool
has_nontrivial_extended_info(𝕃::AbstractLattice, t)::Bool

Determines whether the given lattice element `t` of `𝕃` has non-trivial extended lattice
information that would not be available from the type itself.
Expand All @@ -204,7 +204,7 @@ end
@nospecializeinfer has_nontrivial_extended_info(::JLTypeLattice, @nospecialize(t)) = false

"""
is_const_prop_profitable_arg(𝕃::AbstractLattice, t) -> Bool
is_const_prop_profitable_arg(𝕃::AbstractLattice, t)::Bool

Determines whether the given lattice element `t` of `𝕃` has new extended lattice information
that should be forwarded along with constant propagation.
Expand Down
4 changes: 2 additions & 2 deletions Compiler/src/ssair/domtree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ function rename_nodes!(D::DFSTree, rename_bb::Vector{BBNumber})
end

"""
dominates(domtree::DomTree, bb1::Int, bb2::Int) -> Bool
dominates(domtree::DomTree, bb1::Int, bb2::Int)::Bool
Checks if `bb1` dominates `bb2`.
`bb1` and `bb2` are indexes into the `CFG` blocks.
Expand All @@ -606,7 +606,7 @@ dominates(domtree::DomTree, bb1::BBNumber, bb2::BBNumber) =
_dominates(domtree, bb1, bb2)

"""
postdominates(domtree::PostDomTree, bb1::Int, bb2::Int) -> Bool
postdominates(domtree::PostDomTree, bb1::Int, bb2::Int)::Bool
Checks if `bb1` post-dominates `bb2`.
`bb1` and `bb2` are indexes into the `CFG` blocks.
Expand Down
4 changes: 2 additions & 2 deletions Compiler/src/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2517,7 +2517,7 @@ function getfield_effects(𝕃::AbstractLattice, argtypes::Vector{Any}, @nospeci
end

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

"""
builtin_nothrow(𝕃::AbstractLattice, f::Builtin, argtypes::Vector{Any}, rt) -> Bool
builtin_nothrow(𝕃::AbstractLattice, f::Builtin, argtypes::Vector{Any}, rt)::Bool
Compute throw-ness of a builtin function call. `argtypes` should not include `f` itself.
"""
Expand Down
4 changes: 2 additions & 2 deletions Compiler/src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ may_compress(::AbstractInterpreter) = true
may_discard_trees(::AbstractInterpreter) = true

"""
method_table(interp::AbstractInterpreter) -> MethodTableView
method_table(interp::AbstractInterpreter)::MethodTableView

Returns a method table this `interp` uses for method lookup.
External `AbstractInterpreter` can optionally return `OverlayMethodTable` here
Expand Down Expand Up @@ -486,7 +486,7 @@ add_edges_impl(::Vector{Any}, ::CallInfo) = error("""
All `CallInfo` is required to implement `add_edges_impl(::Vector{Any}, ::CallInfo)`""")
nsplit_impl(::CallInfo) = nothing
getsplit_impl(::CallInfo, ::Int) = error("""
A `info::CallInfo` that implements `nsplit_impl(info::CallInfo) -> Int` must implement `getsplit_impl(info::CallInfo, idx::Int) -> MethodLookupResult`
A `info::CallInfo` that implements `nsplit_impl(info::CallInfo)::Int` must implement `getsplit_impl(info::CallInfo, idx::Int)::MethodLookupResult`
in order to correctly opt in to inlining""")
getresult_impl(::CallInfo, ::Int) = nothing

Expand Down
8 changes: 4 additions & 4 deletions Compiler/src/typeutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function hasuniquerep(@nospecialize t)
end

"""
isTypeDataType(@nospecialize t) -> Bool
isTypeDataType(@nospecialize t)::Bool
For a type `t` test whether ∀S s.t. `isa(S, rewrap_unionall(Type{t}, ...))`,
we have `isa(S, DataType)`. In particular, if a statement is typed as `Type{t}`
Expand Down Expand Up @@ -335,7 +335,7 @@ end
const unwraptv = unwraptv_ub

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

"""
is_immutable_argtype(argtype) -> Bool
is_immutable_argtype(argtype)::Bool
Return `true` if the `argtype` object is known to be immutable.
This query is specifically designed for `getfield_effects` and `isdefined_effects`, allowing
Expand All @@ -366,7 +366,7 @@ function _is_immutable_type(@nospecialize ty)
end

"""
is_mutation_free_argtype(argtype) -> Bool
is_mutation_free_argtype(argtype)::Bool
Return `true` if `argtype` object is mutation free in the sense that no mutable memory
is reachable from this type (either in the type itself) or through any fields
Expand Down
8 changes: 4 additions & 4 deletions Compiler/src/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ isa_compileable_sig(m::ABIOverride) = false
has_typevar(@nospecialize(t), v::TypeVar) = ccall(:jl_has_typevar, Cint, (Any, Any), t, v) != 0

"""
is_declared_inline(method::Method) -> Bool
is_declared_inline(method::Method)::Bool

Check if `method` is declared as `@inline`.
"""
is_declared_inline(method::Method) = _is_declared_inline(method, true)

"""
is_declared_noinline(method::Method) -> Bool
is_declared_noinline(method::Method)::Bool

Check if `method` is declared as `@noinline`.
"""
Expand All @@ -176,14 +176,14 @@ function _is_declared_inline(method::Method, inline::Bool)
end

"""
is_aggressive_constprop(method::Union{Method,CodeInfo}) -> Bool
is_aggressive_constprop(method::Union{Method,CodeInfo})::Bool

Check if `method` is declared as `Base.@constprop :aggressive`.
"""
is_aggressive_constprop(method::Union{Method,CodeInfo}) = method.constprop == 0x01

"""
is_no_constprop(method::Union{Method,CodeInfo}) -> Bool
is_no_constprop(method::Union{Method,CodeInfo})::Bool

Check if `method` is declared as `Base.@constprop :none`.
"""
Expand Down
2 changes: 1 addition & 1 deletion base/Base_compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ if false
end

"""
time_ns() -> UInt64
time_ns()::UInt64
Get the time in nanoseconds relative to some arbitrary time in the past. The primary use is for measuring the elapsed time
between two moments in time.
Expand Down
14 changes: 7 additions & 7 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ julia> Base.elsize(rand(Float32, 10))
elsize(A::AbstractArray) = elsize(typeof(A))

"""
ndims(A::AbstractArray) -> Integer
ndims(A::AbstractArray)::Integer

Return the number of dimensions of `A`.

Expand All @@ -276,7 +276,7 @@ ndims(::Type{<:AbstractArray{<:Any,N}}) where {N} = N::Int
ndims(::Type{Union{}}, slurp...) = throw(ArgumentError("Union{} does not have elements"))

"""
length(collection) -> Integer
length(collection)::Integer

Return the number of elements in the collection.

Expand Down Expand Up @@ -404,8 +404,8 @@ _all_match_first(f::F, inds) where F<:Function = true
keys(s::IndexStyle, A::AbstractArray, B::AbstractArray...) = eachindex(s, A, B...)

"""
lastindex(collection) -> Integer
lastindex(collection, d) -> Integer
lastindex(collection)::Integer
lastindex(collection, d)::Integer

Return the last index of `collection`. If `d` is given, return the last index of `collection` along dimension `d`.

Expand All @@ -427,8 +427,8 @@ lastindex(a::AbstractArray) = (@inline; last(eachindex(IndexLinear(), a)))
lastindex(a, d) = (@inline; last(axes(a, d)))

"""
firstindex(collection) -> Integer
firstindex(collection, d) -> Integer
firstindex(collection)::Integer
firstindex(collection, d)::Integer

Return the first index of `collection`. If `d` is given, return the first index of `collection` along dimension `d`.

Expand Down Expand Up @@ -3196,7 +3196,7 @@ end
## iteration utilities ##

"""
foreach(f, c...) -> Nothing
foreach(f, c...) -> nothing

Call function `f` on each element of iterable `c`.
For multiple iterable arguments, `f` is called elementwise, and iteration stops when
Expand Down
2 changes: 1 addition & 1 deletion base/abstractarraymath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ isreal(x::AbstractArray{<:Real}) = true
## Constructors ##

"""
vec(a::AbstractArray) -> AbstractVector
vec(a::AbstractArray)::AbstractVector
Reshape the array `a` as a one-dimensional column vector. Return `a` if it is
already an `AbstractVector`. The resulting array
Expand Down
18 changes: 9 additions & 9 deletions base/abstractset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ end
const ⊆ = issubset
function ⊇ end
"""
issubset(a, b) -> Bool
⊆(a, b) -> Bool
⊇(b, a) -> Bool
issubset(a, b)::Bool
⊆(a, b)::Bool
⊇(b, a)::Bool

Determine whether every element of `a` is also in `b`, using [`in`](@ref).

Expand Down Expand Up @@ -394,8 +394,8 @@ used to implement specialized methods.
function ⊊ end
function ⊋ end
"""
⊊(a, b) -> Bool
⊋(b, a) -> Bool
⊊(a, b)::Bool
⊋(b, a)::Bool

Determines if `a` is a subset of, but not equal to, `b`.

Expand Down Expand Up @@ -446,8 +446,8 @@ used to implement specialized methods.
function ⊈ end
function ⊉ end
"""
⊈(a, b) -> Bool
⊉(b, a) -> Bool
⊈(a, b)::Bool
⊉(b, a)::Bool

Negation of `⊆` and `⊇`, i.e. checks that `a` is not a subset of `b`.

Expand Down Expand Up @@ -496,7 +496,7 @@ used to implement specialized methods.
## set equality comparison

"""
issetequal(a, b) -> Bool
issetequal(a, b)::Bool

Determine whether `a` and `b` have the same elements. Equivalent
to `a ⊆ b && b ⊆ a` but more efficient when possible.
Expand Down Expand Up @@ -544,7 +544,7 @@ issetequal(a) = Fix2(issetequal, a)

## set disjoint comparison
"""
isdisjoint(a, b) -> Bool
isdisjoint(a, b)::Bool

Determine whether the collections `a` and `b` are disjoint.
Equivalent to `isempty(a ∩ b)` but more efficient when possible.
Expand Down
8 changes: 4 additions & 4 deletions base/anyall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## all & any

"""
any(itr) -> Bool
any(itr)::Bool
Test whether any elements of a boolean collection are `true`, returning `true` as
soon as the first `true` value in `itr` is encountered (short-circuiting). To
Expand Down Expand Up @@ -41,7 +41,7 @@ missing
any(itr) = any(identity, itr)

"""
all(itr) -> Bool
all(itr)::Bool
Test whether all elements of a boolean collection are `true`, returning `false` as
soon as the first `false` value in `itr` is encountered (short-circuiting). To
Expand Down Expand Up @@ -80,7 +80,7 @@ missing
all(itr) = all(identity, itr)

"""
any(p, itr) -> Bool
any(p, itr)::Bool
Determine whether predicate `p` returns `true` for any elements of `itr`, returning
`true` as soon as the first item in `itr` for which `p` returns `true` is encountered
Expand Down Expand Up @@ -154,7 +154,7 @@ end
@inline _any_tuple(f, anymissing) = anymissing ? missing : false

"""
all(p, itr) -> Bool
all(p, itr)::Bool
Determine whether predicate `p` returns `true` for all elements of `itr`, returning
`false` as soon as the first item in `itr` for which `p` returns `false` is encountered
Expand Down
2 changes: 1 addition & 1 deletion base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ function _prepend!(a::Vector, ::IteratorSize, iter)
end

"""
resize!(a::Vector, n::Integer) -> Vector
resize!(a::Vector, n::Integer) -> a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or switched ... to ret_name::RetT.

Took a while to find an example of what exactly this meant.

If the reason to use :: is that this is valid syntax, does this want to use -> when it's not?

Resize `a` to contain `n` elements. If `n` is smaller than the current collection
length, the first `n` elements will be retained. If `n` is larger, the new elements are not
Expand Down
6 changes: 3 additions & 3 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ function (>>>)(B::BitVector, i::UInt)
end

"""
>>(B::BitVector, n) -> BitVector
>>(B::BitVector, n)::BitVector

Right bit shift operator, `B >> n`. For `n >= 0`, the result is `B`
with elements shifted `n` positions forward, filling with `false`
Expand Down Expand Up @@ -1376,7 +1376,7 @@ julia> B >> -1

# signed integer version of shift operators with handling of negative values
"""
<<(B::BitVector, n) -> BitVector
<<(B::BitVector, n)::BitVector

Left bit shift operator, `B << n`. For `n >= 0`, the result is `B`
with elements shifted `n` positions backwards, filling with `false`
Expand Down Expand Up @@ -1413,7 +1413,7 @@ julia> B << -1
(<<)(B::BitVector, i::Int) = (i >=0 ? B << unsigned(i) : B >> unsigned(-i))

"""
>>>(B::BitVector, n) -> BitVector
>>>(B::BitVector, n)::BitVector

Unsigned right bitshift operator, `B >>> n`. Equivalent to `B >> n`. See [`>>`](@ref) for
details and examples.
Expand Down
Loading
Loading