Expand description
Semantic analysis pass over the parsed AST.
The parser produces a syntactic AST and catches structural errors. This module walks the AST to find semantic issues: undefined references, unused bindings, state-machine gaps, and migration hints.
Structs§
- Ambiguous
Imports - Names declared, and triggers provided or emitted, by more than one of a
file’s imported modules. Computed by multi-file checking; an unqualified
reference to one of these names cannot be attributed to a single import
(issue #15). Each entry maps the ambiguous name to the sorted
usealiases it could resolve to — one alias per distinct target file, so two aliases for the same file are not ambiguous. - Reverse
Contributions - Contributions an importing module makes, by qualified reference, to an
imported module’s entities and triggers. Analysis runs per file, so an
imported module never sees the importers that drive its entities. These
contributions are aggregated across every importer in the check set and fed
back into the imported module’s analysis, so a modular spec is analysed as
the equivalent merged single file would be. Empty in single-file mode and
whenever no
useedge links the modules — crediting requires a real import edge, never arbitrary co-supply.
Functions§
- analyse
- Run structural checks plus process-level analysis (
allium analyse). Returns diagnostics and typed findings with evidence. - analyse_
with_ cross_ module - Run structural checks plus process-level analysis with full cross-module context.
- analyse_
with_ external_ refs - Run structural checks plus process-level analysis, accounting for cross-module references.
- analyze
- Run structural checks on a parsed module (
allium check). Returns line-level diagnostics only. - analyze_
with_ cross_ module - Run structural checks with full cross-module context.
- analyze_
with_ external_ refs - Run structural checks, accounting for cross-module references.
- collect_
all_ referenced_ idents - Collect all uppercase identifiers referenced in expressions across a module.
- collect_
declared_ names - Collect all type names declared by a module (entities, external entities, values, enums, actors, contracts, variants).
- collect_
entity_ field_ schemas - Collect each entity/value type’s declared field names, keyed by type name.
- collect_
entity_ status_ schemas - Entity name → its declared status values. The cross-module counterpart of
collect_entity_field_schemas: it gives an importer’s conflict pass the status vocabulary of the entities it imports, so two importer rules acting on an imported entity can be attributed to it and compared for conflict. - collect_
qualified_ references - Collect all qualified-name references (
qualifier/Name) from a module. - collect_
referenced_ trigger_ names - Collect every name a module offers to importers: declared type names
(
collect_declared_names), plus every trigger name it references — provided, emitted (collect_trigger_outputs), or listened for inwhen:clauses. Used by multi-file checking to validate a qualified referencealias/Nameagainst the aliased module — a name it never mentions is a resolution error at the reference (#72, and the name-existence audit). - collect_
reverse_ contributions - Collect the contributions
importermakes toimportedthrough the givenusealias. Only qualified references usingaliasare considered, so an unrelated co-supplied file contributes nothing. Statuses and transitions are filtered to valuesimportedactually declares. - collect_
trigger_ outputs - Collect the trigger names a module makes available to listeners: triggers provided by its surfaces plus triggers emitted by its rules’ ensures clauses (the same sets the unreachable-trigger check consults locally).