Skip to content

Commit 6bb08bf

Browse files
authored
Merge pull request #18345 from JuliaLang/sjk/isdefined-doc
Fix docs for isdefined
2 parents 4533900 + 00cb3f7 commit 6bb08bf

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

base/docs/helpdb/Base.jl

+8-3
Original file line numberDiff line numberDiff line change
@@ -1679,12 +1679,17 @@ eta
16791679
"""
16801680
isdefined([m::Module,] s::Symbol)
16811681
isdefined(object, s::Symbol)
1682-
isdefined(a::AbstractArray, index::Int)
1682+
isdefined(object, index::Int)
1683+
isdefined(a::Array, index::Int)
16831684
16841685
Tests whether an assignable location is defined. The arguments can be a module and a symbol,
1685-
a composite object and field name (as a symbol), or an array and index. With a single
1686-
symbol argument, tests whether a global variable with that name is defined in
1686+
a composite object and field name (as a symbol) or index, or an `Array` and index.
1687+
With a single symbol argument, tests whether a global variable with that name is defined in
16871688
`current_module()`.
1689+
1690+
Note: For `AbstractArray`s other than `Array`, `isdefined` tests whether the given field
1691+
index is defined, not the given array index. To test whether an array index is defined, use
1692+
[`isassigned`](:func:`isassigned`).
16881693
"""
16891694
isdefined
16901695

doc/stdlib/base.rst

+5-2
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,14 @@ All Objects
349349

350350
.. function:: isdefined([m::Module,] s::Symbol)
351351
isdefined(object, s::Symbol)
352-
isdefined(a::AbstractArray, index::Int)
352+
isdefined(object, index::Int)
353+
isdefined(a::Array, index::Int)
353354

354355
.. Docstring generated from Julia source
355356
356-
Tests whether an assignable location is defined. The arguments can be a module and a symbol, a composite object and field name (as a symbol), or an array and index. With a single symbol argument, tests whether a global variable with that name is defined in ``current_module()``\ .
357+
Tests whether an assignable location is defined. The arguments can be a module and a symbol, a composite object and field name (as a symbol) or index, or an ``Array`` and index. With a single symbol argument, tests whether a global variable with that name is defined in ``current_module()``\ .
358+
359+
Note: For ``AbstractArray``\ s other than ``Array``\ , ``isdefined`` tests whether the given field index is defined, not the given array index. To test whether an array index is defined, use :func:`isassigned`\ .
357360

358361
.. function:: convert(T, x)
359362

0 commit comments

Comments
 (0)