Skip to content

Bottom Type

The least type in a declared subtyping order, below every type and useful for typing paths that return no ordinary value.

Version
v1 · 2026-10-03 · History
Domain-specific #
13022
Domain group
Applied Sciences & Engineering
Origin domain
Computer Science & Software Engineering
Subdomains
Type Theory, Programming Language Semantics → Computer Science & Software Engineering
Aliases
Least Type, Universal Subtype

Core Idea

A bottom type is the least type in a declared subtyping order: \(\bot<:T\) for every type \(T\) in that system's stated universe. This explains why a bottom-typed expression can fit many otherwise unrelated expected types. Kotlin calls its bottom type Nothing, Scala also uses Nothing, and TypeScript uses never with corresponding assignability behavior.[1][2][3]

These types have no ordinary runtime instances in the cited systems. A thrown exception or infinite loop can be assigned a bottom static type precisely because it does not return a value. The exception itself is not a value of Nothing, and a loop does not manufacture one.[1][4]

How would you explain it like I'm…

 

No faithful explanation at this level. A toddler-level picture becomes a magic piece or empty value that fits everywhere. That teaches that bottom is a real value you can hold, when it has no runtime instances and is defined by sitting below every type in a subtyping order.

The Never-Returns Type

In some programming languages, every value has a type, like 'number' or 'text', and some types count as special kinds of others. A Bottom Type sits underneath all of them, so the computer lets it go in any slot. No real value ever has this type. It is used for code that never finishes normally, like code that stops the program with an error, so it can sit where a number or text was expected without faking one.

The Universal Subtype

Type systems arrange types in a subtyping order: a subtype can be used wherever its supertype is expected. A Bottom Type is the least type in that order, a subtype of every type. Kotlin and Scala call it Nothing; TypeScript calls it never. It's useful for expressions that never return normally, like throwing an error, exiting, or looping forever: they get the bottom type, so they can appear where a String or any other type is expected. Bottom has no runtime values; a thrown exception isn't a 'Nothing value'. It also differs from an 'empty type', which is defined by having no values rather than by sitting below everything.

 

A Bottom Type ⊥ is the least element of a declared subtyping order: ⊥ <: T for every type T in the universe. That universal lower bound is why a bottom-typed expression can occupy a position expecting an otherwise unrelated type. Kotlin specifies Nothing as the subtype of every well-formed type, Scala says Nothing is a subtype of every type, and TypeScript documents never as assignable to every type; the order relation is the concept, while each language's feature has its own details. The key use is for expressions that don't return an ordinary value — throw, exit, infinite loops — which can be statically typed ⊥; Kotlin types throw as Nothing, and a Nothing-returning fail() can sit where a String is expected. In these designs bottom has no runtime instances: the expression has a static type while evaluation never completes normally with a value of it. Bottom is distinct from an empty type, which is characterized by having no inhabitants and an elimination rule from impossibility (as with Agda's absurd pattern); one type may play both roles, but emptiness alone doesn't establish universal subtyping.

Scope of Application

Kotlin's official example defines a fail function returning Nothing and uses it as the fallback of an expression assigned to String: person.name ?: fail("Name required"). If the name is present, the expression yields a string; otherwise it throws. Nothing is below String, so the nonreturning fallback fits the expected type without claiming it produces a string.[1][4]

TypeScript uses never for another purpose. In an exhaustive switch over a Circle | Square union, the default branch has no remaining variant, so assigning it to never succeeds. Add Triangle without handling it, and the assignment fails: the unhandled variant is not never. This is a compile-time coverage check rather than a runtime never value.[3]

Scala illustrates a third use: its Nil has type List[Nothing], and covariance makes it usable as List[T] for any element type T. That consequence depends on the List variance rule as well as on Nothing being below all types.[2]

Clarity

The bottom test is about position in a type order, not merely about having no values. A live Empty Type entry describes absent inhabitants and elimination from an impossible value. A concrete type can be both empty and bottom, but one must check the language's subtyping rule before equating the identities. Agda's empty datatype with an absurd pattern illustrates the empty-type side; Kotlin's specification explicitly supplies the universal subtype relation.[5][1]

Bottom also differs from Unit or ordinary void-like completion, where a computation may finish normally. It differs from Scala Null, which has a null value and is lower only with respect to reference types; Scala's Nothing is the universal subtype with no instances.[2]

Manages Complexity

One least type can account for many nonreturning paths that otherwise would need separate special typing rules for every possible expected type. The surrounding program can still retain a precise successful result type, as Kotlin's String example shows.[4]

Bottom can also mark a state that should be impossible after all cases of a union have been removed. TypeScript's never assignment converts that fact into an exhaustiveness check. The benefit has a cost: extending the union makes existing exhaustive consumers fail until they handle the new case, which may be desirable assurance or unwanted churn depending on the design.[3]

Abstract Reasoning

First state the type universe and its subtype or assignment relation. Then ask whether the proposed bottom \(B\) satisfies \(B<:T\) for every admissible \(T\). If it is lower only than some category of types, it is not universal bottom for a larger universe.[1][2]

Next separate typing from evaluation. A Nothing-typed throw can fit a String context because it never returns normally. An exhaustively narrowed never branch is unreachable. Neither case proves that a bottom value exists at runtime.[4][3]

Knowledge Transfer

The least-element test transfers across type systems with an appropriate order, but a language's precise nullability, variance, coercion and exhaustiveness rules do not transfer automatically. The broader pattern relates to live prime Order. The proposed DAG link is to live Subtyping as a prerequisite, not a claim that a type is a kind of subtyping relation.

The name remains domain-specific because a least element of an arbitrary order is not thereby a type, and an empty type without a declared subtype relation is not automatically a bottom type.

Relationships to Other Abstractions

Local relationship map for Bottom TypeParents appear above the current abstraction, mutual partners to the right, and children below. Node labels state whether each abstraction is prime or domain-specific; colors identify relation types.Bottom TypeDOMAINDomain-specific abstraction: Subtyping — presupposesSubtypingDOMAIN

Current abstraction Bottom Type Domain-specific

Parents (1) — outgoing typed relations

  • Bottom Type presupposes Subtyping Domain-specific

    A bottom type requires a subtyping relation in which it is below every admissible type.

Hierarchy paths (2) — routes to 2 parentless roots

Neighborhood in Abstraction Space

Bottom Type sits in a sparse region of the domain-specific corpus (77th percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.

Family — Type Systems & Functional Constructs (20 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-11-14

References

[1] Kotlin Language Specification, “Type System,” Built-in Types (kotlin.Nothing) and Upper and Lower Bounds. Official specification. registry ↩a ↩b ↩c ↩d ↩e

[2] Scala 3.2.2 API, scala.Nothing, definition and Nil covariance example. Official Scala API. registry ↩a ↩b ↩c ↩d

[3] TypeScript Handbook, “Narrowing,” “The never type” and “Exhaustiveness checking.” Official handbook. registry ↩a ↩b ↩c ↩d

[4] Kotlin Documentation, “Exception and Error Handling,” “The Nothing type.” Official documentation. registry ↩a ↩b ↩c ↩d

[5] Agda 2.6.3 documentation, “Coverage Checking,” empty datatype and absurd-clause case. Official documentation. registry ↩