Skip to main content

Module unify

Module unify 

Source
Expand description

Unification engine for the bidirectional type checker.

Provides Robinson unification for InferType, which extends LogosType with type variables for the inference pass. After inference, UnificationTable::zonk converts InferType → LogosType. Unsolved variables become LogosType::Unknown, preserving the existing codegen safety net.

§Architecture

InferType  ←  inference pass (this module + check.rs)
    │
    │  zonk (after inference)
    ▼
LogosType  →  codegen (unchanged)

Structs§

TyVar
A type variable used during inference.
TypeScheme
A quantified polymorphic type.
UnificationTable
Union-Find table implementing Robinson unification with occurs check.

Enums§

InferType
Inference-time type representation.
TypeError
A type error detected during unification or checking.

Functions§

infer_to_logos
Convert a zonked InferType to LogosType.
unify_numeric
Numeric promotion: Float wins; Int + Int = Int; Nat + Nat = Nat; Byte + Byte = Byte; otherwise error.