Skip to content

Commit

Permalink
move NamedTuple ctor docs to make them visible (#33304)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Sep 19, 2019
1 parent 64d8ca4 commit c1403bd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
5 changes: 0 additions & 5 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,6 @@ end

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

"""
NamedTuple{names}(args::Tuple)
Construct a named tuple with the given `names` (a tuple of Symbols) from a tuple of values.
"""
NamedTuple{names}(args::Tuple) where {names} = NamedTuple{names,typeof(args)}(args)

using .Intrinsics: sle_int, add_int
Expand Down
23 changes: 23 additions & 0 deletions base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2128,6 +2128,29 @@ See the manual section on [Tuple Types](@ref).
"""
Tuple

"""
NamedTuple{names}(args::Tuple)
Construct a named tuple with the given `names` (a tuple of Symbols) from a tuple of values.
"""
NamedTuple{names}(args::Tuple)

"""
NamedTuple{names,T}(args::Tuple)
Construct a named tuple with the given `names` (a tuple of Symbols) and field types `T`
(a `Tuple` type) from a tuple of values.
"""
NamedTuple{names,T}(args::Tuple)

"""
NamedTuple{names}(nt::NamedTuple)
Construct a named tuple by selecting fields in `names` (a tuple of Symbols) from
another named tuple.
"""
NamedTuple{names}(nt::NamedTuple)

"""
typeassert(x, type)
Expand Down
12 changes: 0 additions & 12 deletions base/namedtuple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ Core.NamedTuple

if nameof(@__MODULE__) === :Base

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

"""
NamedTuple{names}(nt::NamedTuple)
Construct a named tuple by selecting fields in `names` (a tuple of Symbols) from
another named tuple.
"""
function NamedTuple{names}(nt::NamedTuple) where {names}
if @generated
types = Tuple{(fieldtype(nt, n) for n in names)...}
Expand Down

0 comments on commit c1403bd

Please sign in to comment.