Skip to content

Commit c1403bd

Browse files
authored
move NamedTuple ctor docs to make them visible (#33304)
1 parent 64d8ca4 commit c1403bd

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

base/boot.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,11 +541,6 @@ end
541541

542542
NamedTuple() = NamedTuple{(),Tuple{}}(())
543543

544-
"""
545-
NamedTuple{names}(args::Tuple)
546-
547-
Construct a named tuple with the given `names` (a tuple of Symbols) from a tuple of values.
548-
"""
549544
NamedTuple{names}(args::Tuple) where {names} = NamedTuple{names,typeof(args)}(args)
550545

551546
using .Intrinsics: sle_int, add_int

base/docs/basedocs.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,6 +2128,29 @@ See the manual section on [Tuple Types](@ref).
21282128
"""
21292129
Tuple
21302130

2131+
"""
2132+
NamedTuple{names}(args::Tuple)
2133+
2134+
Construct a named tuple with the given `names` (a tuple of Symbols) from a tuple of values.
2135+
"""
2136+
NamedTuple{names}(args::Tuple)
2137+
2138+
"""
2139+
NamedTuple{names,T}(args::Tuple)
2140+
2141+
Construct a named tuple with the given `names` (a tuple of Symbols) and field types `T`
2142+
(a `Tuple` type) from a tuple of values.
2143+
"""
2144+
NamedTuple{names,T}(args::Tuple)
2145+
2146+
"""
2147+
NamedTuple{names}(nt::NamedTuple)
2148+
2149+
Construct a named tuple by selecting fields in `names` (a tuple of Symbols) from
2150+
another named tuple.
2151+
"""
2152+
NamedTuple{names}(nt::NamedTuple)
2153+
21312154
"""
21322155
typeassert(x, type)
21332156

base/namedtuple.jl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ Core.NamedTuple
6363

6464
if nameof(@__MODULE__) === :Base
6565

66-
"""
67-
NamedTuple{names,T}(args::Tuple)
68-
69-
Construct a named tuple with the given `names` (a tuple of Symbols) and field types `T`
70-
(a `Tuple` type) from a tuple of values.
71-
"""
7266
@eval function NamedTuple{names,T}(args::Tuple) where {names, T <: Tuple}
7367
if length(args) != length(names)
7468
throw(ArgumentError("Wrong number of arguments to named tuple constructor."))
@@ -78,12 +72,6 @@ Construct a named tuple with the given `names` (a tuple of Symbols) and field ty
7872
$(Expr(:splatnew, :(NamedTuple{names,T}), :(T(args))))
7973
end
8074

81-
"""
82-
NamedTuple{names}(nt::NamedTuple)
83-
84-
Construct a named tuple by selecting fields in `names` (a tuple of Symbols) from
85-
another named tuple.
86-
"""
8775
function NamedTuple{names}(nt::NamedTuple) where {names}
8876
if @generated
8977
types = Tuple{(fieldtype(nt, n) for n in names)...}

0 commit comments

Comments
 (0)