Expand description
M3: type checker. Walks the canonical AST, infers types via unification, and checks declared signatures and effects.
Structs§
- Parse
Site - Stable identity of a call site inside a checked program (#777).
- Program
Types - Result of checking a whole program.
Functions§
- check_
and_ rewrite_ program - Type-check
stagesand rewrite everymodule.parse(s)call where the inferred T is a Record into the equivalentmodule.parse_strict(s, [field_names])(#168). Existingcheck_programkeeps the old immutable signature for tests and tools that don’t want the AST rewritten. - check_
and_ rewrite_ program_ with_ modules - Like
check_and_rewrite_program, but resolving external dependency references throughmodules(#930) — the publish path checks the same non-inlined head its store gate will, so the two agree. - check_
program - check_
program_ with_ modules - Like
check_program, but with a set of already-resolved dependency modules the head may import by reference (e.g."lex-nt/lib"). Each value is that module’s type — aTy::Recordof its exported functions, the same shapecrate::builtins::module_scopeproduces for stdlib (build one withmodule_record_from_fields). Registry/git dependencies resolve through this map instead of being inlined intostages(#930): the op-log keeps theimportedge and the write-time gate supplies the dependency’s signatures here, so the head still type-checks against them without carrying their bodies. - check_
program_ with_ positions - Variant of
check_programthat stamps a sourcePositiononto every emitted error (#306 slice 1). - module_
record_ from_ fields - Build a dependency module’s value type — a record of its exported
functions — from
(name, type)pairs, forcheck_program_with_modules(#930). Callers never touch the record representation directly. - rewrite_
parse_ calls - Apply the
parse→parse_strict_typed/json_body→json_body_typedrewrite recorded inpttostages.