Skip to content

Commit ee92c24

Browse files
simonstertkelman
authored andcommitted
Fix docs for isdefined
(cherry picked from commit 00cb3f7) ref #18345
1 parent a9e753b commit ee92c24

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

base/docs/helpdb/Base.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4245,12 +4245,17 @@ eta
42454245
"""
42464246
isdefined([m::Module,] s::Symbol)
42474247
isdefined(object, s::Symbol)
4248-
isdefined(a::AbstractArray, index::Int)
4248+
isdefined(object, index::Int)
4249+
isdefined(a::Array, index::Int)
42494250
42504251
Tests whether an assignable location is defined. The arguments can be a module and a symbol,
4251-
a composite object and field name (as a symbol), or an array and index. With a single
4252-
symbol argument, tests whether a global variable with that name is defined in
4252+
a composite object and field name (as a symbol) or index, or an `Array` and index.
4253+
With a single symbol argument, tests whether a global variable with that name is defined in
42534254
`current_module()`.
4255+
4256+
Note: For `AbstractArray`s other than `Array`, `isdefined` tests whether the given field
4257+
index is defined, not the given array index. To test whether an array index is defined, use
4258+
[`isassigned`](:func:`isassigned`).
42544259
"""
42554260
isdefined
42564261

doc/stdlib/base.rst

Lines changed: 5 additions & 2 deletions
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)