This is the IR’s own machine-level type system, deliberately small and
independent of any source language. A front-end lowering its program decides
how its source types map onto these — a 32-bit and a 64-bit source integer both
lower to Type::Int here, a source bool to Type::Bool, and a value that
produces nothing (a statement, a void call) to Type::Unit. The validator
uses these types to reject operations applied to the wrong kind of value, so the
set is kept to the four cases an arithmetic-and-control-flow core actually needs.
Wider machine types (sized integers, vectors, pointers) are a deliberate later
addition: a new variant is an additive, non-breaking change.
use ir_lang::Type;
// Types are small, `Copy`, and print as their lowercase name.
assert_eq!(Type::Int.to_string(), "int");
assert_eq!(Type::Bool.to_string(), "bool");
assert_ne!(Type::Int, Type::Float);