Skip to content

Commit

Permalink
expand the doc string of Union{}
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 committed Jul 28, 2024
1 parent 7de15ba commit 41561a9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3186,13 +3186,23 @@ 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`.
property `isa(x, Union{}) == false` for any `x`. Thus it is an *empty*/*uninhabited* type.
A property of `Union{}` is that it's the *bottom* type of the type system. That is, for each `T`
such that `T isa Type`, `Union{} <: T`. Refer to the subtyping operator's documentation: [`<:`](@ref).
`Base.Bottom` is defined as its alias and the type of `Union{}` is `Core.TypeofBottom`.
# Examples
```jldoctest
julia> isa(nothing, Union{})
false
julia> Union{} <: Union{} <: Int
true
julia> typeof(Union{}) === Core.TypeofBottom
true
```
"""
kw"Union{}", Base.Bottom
Expand Down

0 comments on commit 41561a9

Please sign in to comment.