Skip to content

Commit

Permalink
Documentation: added example to the function hasfield. (From #41782) (#…
Browse files Browse the repository at this point in the history
…44274)

Co-authored-by: Johnny Chen <[email protected]>
(cherry picked from commit 9c0e5b0d186ea95a06d5b0bdc4bc19d1a17b444d)
  • Loading branch information
ViralBShah authored Feb 23, 2022
1 parent 0db596e commit aa2421d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,23 @@ fieldnames(t::Type{<:Tuple}) = ntuple(identity, fieldcount(t))
Return a boolean indicating whether `T` has `name` as one of its own fields.
See also [`fieldnames`](@ref), [`fieldcount`](@ref), [`hasproperty`](@ref).
!!! compat "Julia 1.2"
This function requires at least Julia 1.2.
# Examples
```jldoctest
julia> struct Foo
bar::Int
end
julia> hasfield(Foo, :bar)
true
julia> hasfield(Foo, :x)
false
```
"""
function hasfield(T::Type, name::Symbol)
@_pure_meta
Expand Down

2 comments on commit aa2421d

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here.

Please sign in to comment.