Sibling articles under this feature previously restated requirements in inconsistent forms.
Resolver contract - Examples
Platform spec article
Resolver contract - Examples
Spec standingStandard
-
This feature hub owns normative MUST/SHOULD contract text for Resolver contract.
Context
Decision
This feature hub owns normative MUST/SHOULD contract text. Sibling articles must not redefine hub requirements and should link here for authority.
Consequences
Contract changes start on the hub or in linked ADRs, then propagate to articles and implementation anchors.
Verification anchors
site/website/src/content/docs/platform-spec/compiler/semantic-pipeline/resolver-contract/index.mdxarticle bundle under the same feature directory.
-
Platform-spec text supersedes informal crate comments for Resolver contract.
Context
Implementation crates accumulated informal notes that diverged from published contracts.
Decision
Normative platform-spec prose and ADRs under this feature supersede informal comments in implementation crates until explicitly migrated into spec text.
Consequences
Engineers file spec/ADR updates when behavior changes; crate comments are non-authoritative for conformance arguments.
Verification anchors
compiler/crates/beskid_analysis/src/resolve/resolver.rscompiler/crates/beskid_analysis/src/resolve/items.rscompiler/crates/beskid_tests/src/analysis/resolve.rs
-
This feature hub defines the normative contract for **resolver contract** and links newcomer-oriented reference articles
Context
This feature hub defines the normative contract for resolver contract and links newcomer-oriented reference articles.
Decision
The reference compiler must implement Resolver contract as documented in this feature hub and its article bundle.
Consequences
Changes require hub/ADR updates and verification anchor extensions.
Verification anchors
compiler/crates/beskid_analysis/src/resolve/resolver.rscompiler/crates/beskid_analysis/src/resolve/items.rscompiler/crates/beskid_tests/src/analysis/resolve.rs
-
use Module.Path brings public types and enum constructors into unqualified scope.
Context
use Core.Resultsregistered module aliases for member completion (IO.PrintLine) but did not import public types or enum constructors into unqualified value/type scope—breaking patterns such asResult::Okafteruse Core.Results.Decision
When resolving
use Logical.Module.Path(with optionalas Alias):Binding Rule Module alias Existing module_importsbehavior for qualified member access remainsPublic types Each public typeexported from the target module must bind in type scope under its simple name (or alias)Enum constructors Each public enum constructor must bind in value scope as Type::Variantand, when the type name is in scope, as unqualified constructor names per language-meta visibility rulesNon-public items Must not be introduced into scope via useConsequences
Resolver and
items.rsgrowuse-import registration beyond alias tables. Analysis fixtures coverCore.Results/Result::Okpatterns.Verification anchors
compiler/crates/beskid_analysis/src/resolve/resolver.rscompiler/crates/beskid_analysis/src/resolve/items.rscompiler/crates/beskid_tests/src/analysis/resolve.rscompiler/corelib/beskid_corelib/tests/corelib_tests/src/core/ResultsTests.bd
-
SymbolQualifier and SymbolRegistry as stable cross-unit definition identity alongside dense ItemId.
Context
ItemId(usize)is a dense, phase-local index intoResolution.items. It works for span tables and type maps inside one merged resolution, but cross-unit tooling (LSP workspace references, link-plan discovery, registry docs) needs a stable definition key that survives per-unit re-resolve and prefetch/entry merge.Qualified names were previously recomputed post-hoc in doc emission (
qualified_names.rs) without a single authoritative registry. Duplicate export names could last-win silently in helper scans.Decision
Introduce package-prefixed canonical symbol identity parallel to
ItemId:Type Role SymbolQualifier{ package, shape }— package isCompilePlan.project_namefor the entry/host unit or the dependencyproject_namefor prefetched units; builtins use fixed packagebeskidSymbolShapeEncodes module items, members, methods, and builtins into one ::-separated stringSymbolIdInterned key into SymbolRegistryResolution.by_symbolMaps SymbolId→ authoritativeItemIdafter collectHot paths keep
ItemId. Type maps, scoped span tables, andLocalIdstay unchanged. Symbol identity is authoritative for:- cross-unit definition identity (IDE references, link-plan callee discovery),
api.jsonsymbolKeywhen the row is registry-backed,@ref/ type-ref lookup by full package-prefixed path.
Collection assigns
ItemInfo.symbolfor exportable rows; duplicateSymbolQualifiervalues must surface as structured resolve errors instead of silent last-wins in name scans.Canonical lookup helpers live in
resolve/symbol_lookup.rs(symbol_for_item,item_id_for_symbol,canonical_item_id,qualified_name).Encoding (normative examples)
Shape Example key Module export corelib::Std::Console::Capabilities::ShouldEmitAnsiMember corelib::Std::Console::Capabilities::colorDisabledMethod corelib::Capabilities::ShouldEmitAnsi(receiver string + method name)Builtin beskid::rangequalifiedNameonapi.jsonrows may retain legacy module-relative strings for display;symbolKeycarries the registry string when present (D-TOOL-CLI-0003).Consequences
ModuleIndexprefetch clones one shared registry into entry and per-unit resolve paths.- IDE
references_at_offset_workspacematches references bySymbolIdwhen both sides have registry symbols, not rawItemIdequality across unit re-resolve. - Codegen
FunctionDefIndexand link-plan visitation useby_symbolas the primary callee index; span scans are fallback only. - Tests and golden
api.jsonfixtures gainsymbolKeyon exportable symbols when re-emitted with a current CLI.
Verification anchors
compiler/crates/beskid_analysis/src/resolve/symbol.rscompiler/crates/beskid_analysis/src/resolve/symbol_lookup.rscompiler/crates/beskid_analysis/src/resolve/collect.rscompiler/crates/beskid_analysis/src/projects/assembly/module_index.rscompiler/crates/beskid_analysis/src/services/document.rs(symbol-aware references)compiler/crates/beskid_codegen/src/linking/def_index.rs
- Resolver contract - Contracts and edge cases Normative resolver guarantees including SymbolRegistry invariants and cross-unit reference matching.
- Resolver contract - Design model Persistent resolver entities including SymbolRegistry, ItemId, and cross-unit identity.
- Resolver contract - Examples Concrete symbol identity and cross-unit reference scenarios.
- Resolver contract - FAQ and troubleshooting Answers common operator and contributor questions with practical next checks.
- Resolver contract - Flow and algorithm Walks through runtime/order-of-operations behavior in the implementation.
- Resolver contract - Verification and traceability Tests and code anchors proving SymbolRegistry and cross-unit reference behavior.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
Prefetch dependency symbol
Section titled “Prefetch dependency symbol”Main.bd calls Output.WriteLine from a dependency unit collected into ModuleIndex:
| Identity | Example |
|---|---|
ItemId | Dense index into merged items (stable for prefetch rows) |
SymbolId | Interned key for export |
symbolKey (api.json) | corelib_mvp::Std::System::IO::Output::WriteLine (exact package prefix from materialized project) |
qualifiedName | May use module-relative display; prefer symbolKey for cross-package links |
Workspace find-references on the WriteLine use site must include references in Output.bd when assembly is available.
Entry-defined symbol referenced elsewhere
Section titled “Entry-defined symbol referenced elsewhere”helper() declared in the entry unit and called from a dependency file:
- Entry merged resolution assigns
helpera registry symbol under the hostproject_name. - Per-unit resolve of the dependency file may assign a different dense
ItemIdto the same logical import target. - IDE reference matching must still succeed via equal
SymbolId, notItemIdequality.
@ref by full symbol key
Section titled “@ref by full symbol key”Documentation comment:
/// See also @ref(corelib::Std::Console::Esc)Resolution must locate the target item by exact registry string before falling back to qualifiedName suffix heuristics (doc/refs.rs).
Non-exportable rows
Section titled “Non-exportable rows”Parameters and other synthetics have ItemInfo.symbol: None. They omit symbolKey in api.json and use ItemId / local identity in IDE queries.
Anchored fixtures
Section titled “Anchored fixtures”compiler/crates/beskid_e2e_tests/fixtures/corelib_mvp/— assembly-backed document testscompiler/corelib/beskid_corelib/tests/corelib_tests/— corelib integration surfaces