Skip to content

Commit

Permalink
expand the doc string of Union{} (#55291)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nsajko authored Jul 30, 2024
1 parent 5d80593 commit 6bc2c55
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3185,14 +3185,27 @@ Any
"""
Union{}
`Union{}`, the empty [`Union`](@ref) of types, is the type that has no values. That is, it has the defining
property `isa(x, Union{}) == false` for any `x`. `Base.Bottom` is defined as its alias and the type of `Union{}`
is `Core.TypeofBottom`.
`Union{}`, the empty [`Union`](@ref) of types, is the *bottom* type of the type system. That is, for each
`T::Type`, `Union{} <: T`. Also see the subtyping operator's documentation: [`<:`](@ref).
As such, `Union{}` is also an *empty*/*uninhabited* type, meaning that it has no values. That is, for each `x`,
`isa(x, Union{}) == false`.
`Base.Bottom` is defined as its alias and the type of `Union{}` is `Core.TypeofBottom`.
# Examples
```jldoctest
julia> isa(nothing, Union{})
false
julia> Union{} <: Int
true
julia> typeof(Union{}) === Core.TypeofBottom
true
julia> isa(Union{}, Union)
false
```
"""
kw"Union{}", Base.Bottom
Expand Down

0 comments on commit 6bc2c55

Please sign in to comment.