Skip to main content

Module resolve

Module resolve 

Source
Expand description

Best-effort name resolution over an assembled view (ticket G).

The base graph is a heuristic call graph: references match a target by name, so callers_of("foo") returns callers of any foo. This layer resolves each reference to the specific defining path it most likely means, disambiguating same-named symbols across files:

  1. Qualified — the call site named an owner (Beta::get()) and exactly one definition in the view is owned by it (#248).
  2. Local — a definition of the name in the reference’s own file wins.
  3. Unique global — otherwise, the sole definition across the view.
  4. Ambiguous — multiple definitions and none local: left unresolved.
  5. Unresolved — no definition in the view (honest dangling, ADR 0012).

The qualifier rule only ever narrows. A Rust qualifier is as often a module as a type, and most modules are files rather than inline mod blocks, so nothing in the view is owned by them; declining those edges would lose attributions the view makes correctly today. When a qualifier matches no owner it is ignored and the remaining rules apply unchanged.

Resolution is file-scoped (not yet import-aware); it is a pure function of a GraphStore’s query methods, so it works over any backend and adds no trait surface. Import-following resolution is a further step, and is also what would let a module path be told from a type — at which point an unmatched qualifier could decline rather than fall through (#252).

Structs§

ImpactNode
One symbol reached by an impact closure, identified by the path that defines it rather than by name alone.
ImpactReport
The result of a resolution-gated impact walk.
ResolvedReference
A reference resolved (best-effort) to the path of the symbol it refers to.

Enums§

Resolution
How a reference was resolved to a definition.

Functions§

resolve_references_to
Resolve every reference to name to a defining path (see the module docs for the strategy).
resolved_callers_of
Enclosing functions that call the name defined at defining_path — the precision refinement of GraphStore::callers_of, which returns callers of any same-named symbol. Sorted and deduped.
resolved_impact
The transitive closure of callers of name, following only edges that resolve to a specific definition.