Skip to main content

Module checker

Module checker 

Source
Expand description

M3: type checker. Walks the canonical AST, infers types via unification, and checks declared signatures and effects.

Structs§

ParseSite
Stable identity of a call site inside a checked program (#777).
ProgramTypes
Result of checking a whole program.

Functions§

check_and_rewrite_program
Type-check stages and rewrite every module.parse(s) call where the inferred T is a Record into the equivalent module.parse_strict(s, [field_names]) (#168). Existing check_program keeps 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 through modules (#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 — a Ty::Record of its exported functions, the same shape crate::builtins::module_scope produces for stdlib (build one with module_record_from_fields). Registry/git dependencies resolve through this map instead of being inlined into stages (#930): the op-log keeps the import edge 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_program that stamps a source Position onto 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, for check_program_with_modules (#930). Callers never touch the record representation directly.
rewrite_parse_calls
Apply the parseparse_strict_typed / json_bodyjson_body_typed rewrite recorded in pt to stages.