Skip to content

Commit 081f045

Browse files
authored
doc: Explicitly document how to add docstrings for inner constructors (JuliaLang#52995)
xref JuliaLang#14962
1 parent 68c0b2d commit 081f045

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

doc/src/manual/documentation.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,9 @@ end
314314
@doc "`subtract(a,b)` subtracts `b` from `a`" subtract
315315
```
316316

317-
Documentation in non-toplevel blocks, such as `begin`, `if`, `for`, and `let`, should be
318-
added to the documentation system via `@doc` as well. For example:
317+
Documentation in non-toplevel blocks, such as `begin`, `if`, `for`, `let`, and
318+
inner constructors, should be added to the documentation system via `@doc` as
319+
well. For example:
319320

320321
```julia
321322
if condition()
@@ -464,11 +465,17 @@ struct T
464465
x
465466
"y"
466467
y
468+
469+
@doc "Inner constructor"
470+
function T()
471+
new(...)
472+
end
467473
end
468474
```
469475

470-
Adds docstring `"..."` to type `T`, `"x"` to field `T.x` and `"y"` to field `T.y`. Also applicable
471-
to `mutable struct` types.
476+
Adds docstring `"..."` to type `T`, `"x"` to field `T.x`, `"y"` to field `T.y`,
477+
and `"Inner constructor"` to the inner constructor `T()`. Also applicable to
478+
`mutable struct` types.
472479

473480
### Modules
474481

0 commit comments

Comments
 (0)