100%

Trait-dispatch-resolved reference Occurrences + role bits

Goal

Deliver the accuracy core: SCIP references keyed by resolved targets, replacing name-matching with compiler-resolved edges.

Implementation Sketch

  • Reference Occurrences are emitted per call site. No single ResolvedCall/resolved_method struct carries the resolved target today (grounded: no such symbol in compiler_repo/compiler/ori_types/src/).
  • Resolution surfaces across TypedModule.mono_dispatch_map: Vec<(ExprId, MonoInstanceId)> (compiler_repo/compiler/ori_types/src/output/typed_module.rs:207, generic call site -> resolved monomorphization instance), impl_sigs: Vec<(Name, FunctionSig)> (:161), trait_impl_fn_names: Vec<(Idx, Name)> (:173).
  • Plumbing a per-call-site resolved-target query mapping an ExprId method call to the concrete impl’s SCIP symbol string IS the load-bearing accuracy work of this section.
  • The PC-2 invariant (all method calls statically resolved, typeck.md §PC-2) guarantees the resolution exists. The AOT PC-2 walker at compiler_repo/compiler/oric/src/commands/codegen_pipeline/pc2_hooks.rs is the reference for a Tag::Var-free post-PC-2 walk shape (cited for the invariant, NOT consumed by the emitter).
  • SCIP role bits come from the scip crate’s SymbolRole enum (Definition=0x1, Import, WriteAccess, ReadAccess, …).

Spec References

SCIP Occurrence { range, symbol, symbol_roles } (role bitmask); SCIP SymbolRole enum. PC-2 static-resolution contract: typeck.md §PC-2 + canon.md §4.2 (all method calls resolved statically via builtin-first resolve_builtin_method() / TraitRegistry::lookup_method()).

Work Items

  • Emit SCIP reference Occurrences carrying trait-dispatch-resolved targets and SCIP role bitmasks (Definition/Reference/ReadAccess/etc.), so a trait-method call references the concrete impl target the type checker resolved, not the syntactic method name. COMPILER-RIGOR: positive semantic pin (trait-method call resolves to the concrete impl target in the SCIP output) + negative pin (an ambiguous name does NOT resolve to a wrong target).

Test Coverage

  • L2 Typecheck / trait-dispatch resolution — COVERED: the positive + negative pins assert the SCIP reference Occurrence carries the type-checker-resolved concrete impl target. This is the accuracy core.
  • L1 Parse — COVERED: the L12 prod path runs emit-scip on a real .ori (must parse).
  • L12 Production entry point — COVERED: pins drive the REAL oric emit-scip CLI on a REAL target with a trait-method call and assert the resolved-target Occurrence in the emitted index.
  • L3 Canonicalize / L4 ARC-AIMS / L5 Eval / L6 LLVM-debug / L7 LLVM-release / L8 AOT — N/A: emitter reads typed IR; no canon consumption, no runtime, no codegen, no binary.
  • L9 Dual-execution parity — N/A: emitter, not an eval-path.
  • L10 Leak check — N/A: compile-time subcommand.
  • L11 Spec conformance — N/A: tooling output, not language behavior.