pub fn resolve(package: &Package) -> Result<Program, Vec<Diagnostic>>Expand description
Resolves every module of package into the flat program the runtime
executes.
Because a module may name another module’s exported declarations, this is a package-wide pass rather than a per-module one:
- each module’s surface — what it declares, and whether each
declaration is exported — is collected, since a
usein one module is answered by another module’s declarations; - every
useis resolved against the package’s modules first and the host registry second (ADR 0005); - the module dependency graph is checked for cycles, which ADR 0005 forbids;
- each module’s own declarations are merged across its units;
- required capabilities, and the reasons they are only a lower bound, are derived as a fixed point over the package’s call graph, so a function reaching a Host API through an imported helper reports it and a function reaching an indirect call through one says so;
- every body is checked against everything now known, including enums reached through an import.