Skip to content

Commit dc0b0df

Browse files
committed
Add inline documentation for Type and DataType.
Closes #23655.
1 parent e3f91bd commit dc0b0df

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

base/docs/basedocs.jl

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,76 @@ The singleton type containing only the value `Union{}` (which represents the emp
11501150
"""
11511151
Core.TypeofBottom
11521152

1153+
"""
1154+
Core.Type{T} where T
1155+
1156+
`Core.Type` is an abstract type which has all type objects as its instances.
1157+
The only instance of the singleton type `Core.Type{T} where T` is the object
1158+
`T`.
1159+
1160+
# Examples
1161+
```jldoctest
1162+
julia> isa(Type{Float64}, Type)
1163+
true
1164+
1165+
julia> isa(Float64, Type)
1166+
true
1167+
1168+
julia> isa(1, Type)
1169+
false
1170+
1171+
julia> isa("foo", Type)
1172+
false
1173+
1174+
julia> isa(Float64, Type{Float64})
1175+
true
1176+
1177+
julia> isa(Real, Type{Float64})
1178+
false
1179+
1180+
julia> isa(Real, Type{Real})
1181+
true
1182+
1183+
julia> isa(Float64, Type{Real})
1184+
false
1185+
```
1186+
"""
1187+
Core.Type
1188+
1189+
"""
1190+
DataType <: Type{T}
1191+
1192+
`DataType` represents explicitly declared types that have names, explicitly
1193+
declared supertypes, and, optionally, parameters. Every concrete value in the
1194+
system is an instance of some `DataType`.
1195+
1196+
# Examples
1197+
```jldoctest
1198+
julia> typeof(Real)
1199+
DataType
1200+
1201+
julia> typeof(Int)
1202+
DataType
1203+
1204+
julia> struct Point
1205+
x::Int
1206+
y
1207+
end
1208+
1209+
julia> typeof(Point)
1210+
DataType
1211+
1212+
julia> fieldnames(Point)
1213+
2-element Array{Symbol,1}:
1214+
:x
1215+
:y
1216+
1217+
julia> Point.types
1218+
svec(Int64, Any)
1219+
```
1220+
"""
1221+
Core.DataType
1222+
11531223
"""
11541224
Function
11551225

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)