Expand description
Discovery + planning for recursive alias and data-interface validators.
x as T lowers to a structural walk of T. When T is
recursive the walk would loop forever at codegen time, so recursive alias
and interface back-edges are compiled to calls into generated helpers.
Each helper validates the declaration’s expanded shape or runtime interface
descriptor, and recursion terminates on the finite input value instead.
This module finds every back-edge reachable from any runtime structural check (casts and narrowed-field/interface guards), records the expanded body each helper must emit, and collects the object shapes those bodies need so the subtype/vtable pre-pass emits them even when no literal of that shape appears in the program.
Structs§
- Recursive
Validators - Generated runtime validators and the extra object shapes their bodies need.
- Validator
Bodies - Resolves a recursion back-edge to its body, for both
Type::AliasRef(→ alias body) andType::InterfaceRef(→ structural object of a data-only interface’s properties). Imported declarations are keyed by nominal identity; local declarations use their source names because the typed declaration nodes do not retain their mangled identities. - Validator
Plan - One generated validator: the back-edge it keys on and the expanded body its
function emits.
func_idx/type_idxare filled in during index allocation.