pub struct TypeChecker { /* private fields */ }Implementations§
Source§impl TypeChecker
impl TypeChecker
pub fn new() -> Self
Sourcepub fn set_call_graph(&mut self, call_graph: CallGraph)
pub fn set_call_graph(&mut self, call_graph: CallGraph)
Set the call graph for mutual recursion detection.
When set, the type checker can detect divergent branches caused by mutual recursion (e.g., even/odd pattern) in addition to direct recursion.
Sourcepub fn get_union(&self, name: &str) -> Option<&UnionTypeInfo>
pub fn get_union(&self, name: &str) -> Option<&UnionTypeInfo>
Look up a union type by name
Sourcepub fn get_unions(&self) -> &HashMap<String, UnionTypeInfo>
pub fn get_unions(&self) -> &HashMap<String, UnionTypeInfo>
Get all registered union types
Sourcepub fn register_external_words(&mut self, words: &[(&str, &Effect)])
pub fn register_external_words(&mut self, words: &[(&str, &Effect)])
Register external word effects (e.g., from included modules or FFI).
All external words must have explicit stack effects for type safety.
Sourcepub fn register_external_unions(&mut self, union_names: &[&str])
pub fn register_external_unions(&mut self, union_names: &[&str])
Register external union type names (e.g., from included modules).
This allows field types in union definitions to reference types from includes. We only register the name as a valid type; we don’t need full variant info since the actual union definition lives in the included file.
Sourcepub fn take_quotation_types(&self) -> HashMap<usize, Type>
pub fn take_quotation_types(&self) -> HashMap<usize, Type>
Extract the type map (quotation ID -> inferred type)
This should be called after check_program() to get the inferred types for all quotations in the program. The map is used by codegen to generate appropriate code for Quotations vs Closures.
Sourcepub fn take_statement_top_types(&self) -> HashMap<(String, usize), Type>
pub fn take_statement_top_types(&self) -> HashMap<(String, usize), Type>
Extract per-statement type info for codegen optimization (Issue #186) Returns map of (word_name, statement_index) -> top-of-stack type
Sourcepub fn take_aux_max_depths(&self) -> HashMap<String, usize>
pub fn take_aux_max_depths(&self) -> HashMap<String, usize>
Extract per-word aux stack max depths for codegen alloca sizing (Issue #350)