Skip to content

Commit 6bc2c55

Browse files
authored
expand the doc string of Union{} (#55291)
Give some characterizations/relevant terms from type theory. Clarify the, previously unexplained, usage of "bottom" in names. Cross-reference the subtyping doc string. Add an entry to the doctest, clarifying the last sentence.
1 parent 5d80593 commit 6bc2c55

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

base/docs/basedocs.jl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3185,14 +3185,27 @@ Any
31853185
"""
31863186
Union{}
31873187
3188-
`Union{}`, the empty [`Union`](@ref) of types, is the type that has no values. That is, it has the defining
3189-
property `isa(x, Union{}) == false` for any `x`. `Base.Bottom` is defined as its alias and the type of `Union{}`
3190-
is `Core.TypeofBottom`.
3188+
`Union{}`, the empty [`Union`](@ref) of types, is the *bottom* type of the type system. That is, for each
3189+
`T::Type`, `Union{} <: T`. Also see the subtyping operator's documentation: [`<:`](@ref).
3190+
3191+
As such, `Union{}` is also an *empty*/*uninhabited* type, meaning that it has no values. That is, for each `x`,
3192+
`isa(x, Union{}) == false`.
3193+
3194+
`Base.Bottom` is defined as its alias and the type of `Union{}` is `Core.TypeofBottom`.
31913195
31923196
# Examples
31933197
```jldoctest
31943198
julia> isa(nothing, Union{})
31953199
false
3200+
3201+
julia> Union{} <: Int
3202+
true
3203+
3204+
julia> typeof(Union{}) === Core.TypeofBottom
3205+
true
3206+
3207+
julia> isa(Union{}, Union)
3208+
false
31963209
```
31973210
"""
31983211
kw"Union{}", Base.Bottom

0 commit comments

Comments
 (0)