Skip to main content

Module analysis

Module analysis 

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

AmbiguousImports
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 use aliases it could resolve to — one alias per distinct target file, so two aliases for the same file are not ambiguous.
ReverseContributions
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 use edge 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 in when: clauses. Used by multi-file checking to validate a qualified reference alias/Name against 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 importer makes to imported through the given use alias. Only qualified references using alias are considered, so an unrelated co-supplied file contributes nothing. Statuses and transitions are filtered to values imported actually 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).