Skip to main content

Module recursive_validators

Module recursive_validators 

Source
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§

RecursiveValidators
Generated runtime validators and the extra object shapes their bodies need.
ValidatorBodies
Resolves a recursion back-edge to its body, for both Type::AliasRef (→ alias body) and Type::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.
ValidatorPlan
One generated validator: the back-edge it keys on and the expanded body its function emits. func_idx/type_idx are filled in during index allocation.

Functions§

discover