100%

oric emit-scip subcommand + SCIP definition emission

Goal

Ship the production emit-scip entry point + SCIP serialization for definitions, so reference resolution (section-02) has stable definition symbols to point at.

Implementation Sketch

  • Add the SCIP protobuf dependency — the official scip crate (rust-analyzer emits through it; matches the ingest format exactly). The hand-rolled-protobuf alternative is a design decision a reviewer should confirm.
  • Emit one SymbolInformation per declared entity by walking TypedModule (compiler_repo/compiler/ori_types/src/output/typed_module.rs:122): functions: Vec<FunctionSig> (:132), types: Vec<TypeEntry> (:138), impl_sigs: Vec<(Name, FunctionSig)> (:161), trait_impl_fn_names: Vec<(Idx, Name)> (:173).
  • The SCIP symbol string must be globally stable (module path + entity path) so occurrence->definition joins (section-03) key on it.
  • The subcommand arm sits at compiler_repo/compiler/oric/src/main.rs:59 next to "check" (:201); the handler module + re-export go in compiler_repo/compiler/oric/src/commands/mod.rs. Type names render via the Pool from typed_pool() (compiler_repo/compiler/oric/src/query/mod.rs:255).

Spec References

  • SCIP SymbolInformation { symbol, ... } for definitions; SCIP symbol string grammar (scheme ’ ’ package ’ ’ descriptors).
  • PC-2: typeck.md §PC-2. TypedModule field contract: compiler_repo/compiler/ori_types/src/output/typed_module.rs.

Work Items

  • Land the oric emit-scip subcommand emitting a full SCIP index of definition SymbolInformation from oric’s typed IR after PC-2: one SymbolInformation per top-level function, type, trait, impl method, and field, with globally-stable SCIP symbol strings. COMPILER-RIGOR: full TDD matrix (types x patterns) on the emitter; emitter exercised under oric built debug + release; /tpr-review then /impl-hygiene-review.

Test Coverage

  • L1 Parse — COVERED: the L12 prod-path test runs emit-scip on a real .ori file (must parse).
  • L2 Typecheck — COVERED: definitions come from the post-PC-2 TypedModule; a type error suppresses emission (gated like check_file).
  • L12 Production entry point — COVERED: the criterion drives the REAL oric emit-scip CLI on a REAL target and asserts the SCIP definition output shape (not a seam-injected unit test).
  • L3 Canonicalize / L4 ARC-AIMS / L5 Eval / L6 LLVM-debug / L7 LLVM-release / L8 AOT — N/A: emitter reads typed IR after PC-2; runs no program, lowers no runtime, emits no native binary. (The emitter logic IS exercised under oric built debug + release as a real Rust-binary build check — that is not the L6/L7 LLVM-program-codegen layer.)
  • L9 Dual-execution parity — N/A: emitter, not an eval-path.
  • L10 Leak check — N/A: compile-time subcommand, never runs the program.
  • L11 Spec conformance — N/A: SCIP emission is tooling output, not spec-defined Ori language behavior.