Skip to content

Commit 9507225

Browse files
phrbmbauman
andauthored
Add inline documentation for Type and DataType. (#24561)
* Add inline documentation for Type and DataType. Closes #23655. * Fix type annotation and clean up examples * Apply suggestions from code review Co-authored-by: Matt Bauman <mbauman@gmail.com> Co-authored-by: Matt Bauman <mbauman@gmail.com>
1 parent f2fa6cf commit 9507225

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

base/docs/basedocs.jl

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,56 @@ The singleton type containing only the value `Union{}` (which represents the emp
11301130
"""
11311131
Core.TypeofBottom
11321132

1133+
"""
1134+
Core.Type{T}
1135+
1136+
`Core.Type` is an abstract type which has all type objects as its instances.
1137+
The only instance of the singleton type `Core.Type{T}` is the object
1138+
`T`.
1139+
1140+
# Examples
1141+
```jldoctest
1142+
julia> isa(Type{Float64}, Type)
1143+
true
1144+
1145+
julia> isa(Float64, Type)
1146+
true
1147+
1148+
julia> isa(Real, Type{Float64})
1149+
false
1150+
1151+
julia> isa(Real, Type{Real})
1152+
true
1153+
```
1154+
"""
1155+
Core.Type
1156+
1157+
"""
1158+
DataType <: Type{T}
1159+
1160+
`DataType` represents explicitly declared types that have names, explicitly
1161+
declared supertypes, and, optionally, parameters. Every concrete value in the
1162+
system is an instance of some `DataType`.
1163+
1164+
# Examples
1165+
```jldoctest
1166+
julia> typeof(Real)
1167+
DataType
1168+
1169+
julia> typeof(Int)
1170+
DataType
1171+
1172+
julia> struct Point
1173+
x::Int
1174+
y
1175+
end
1176+
1177+
julia> typeof(Point)
1178+
DataType
1179+
```
1180+
"""
1181+
Core.DataType
1182+
11331183
"""
11341184
Function
11351185

doc/src/base/base.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ Base.identity
147147

148148
```@docs
149149
Base.supertype
150+
Core.Type
151+
Core.DataType
150152
Core.:(<:)
151153
Base.:(>:)
152154
Base.typejoin

0 commit comments

Comments
 (0)