Files
Language-Server/docs/roadmap/12-reflection-provenance.md
T
faumaray ca04975d54 bootstrap
Signed-off-by: faumaray <faumaray@gmail.com>
2026-11-25 02:11:19 +03:00

3.0 KiB

12 — Reflection, meta values and generated-source provenance

Status: PLANNED; no implementation claim Requirements: R-010,R-013,R-014,R-015,R-016 Dependencies: 08,09,11 for module-crossing cases; shared SymbolIdentity with15/16 and events with17.

Ownership and boundaries

Proposed Astra: NEW include/vls/reflection/, src/reflection/, tests/reflection/. Root owns provenance/value DTO schemas. Future assignments must verify the then-current baseline and exact disjoint paths; these proposed scopes do not authorize work in another repository.

Contracts and data flow

Represent real compiler reflection values/entities, splices and expansions with type information and SourceOrigin chains. Distinguish editable spelling, expansion/splice site, original reflected declaration and synthesized entity. Virtual generated views are read-only semantic explanations and may not be compilable text.

Implementation sequence

  1. Maintain a proposal/version capability matrix for the accepted backend, covering P2996 and associated expansion/static-data/annotation facilities actually used by Void projects.
  2. Extract reflected entities and generated members from compiler state, preserving context/instantiation identity rather than inventing symbols from source strings.
  3. Implement hover/completion/navigation adapters and virtual-source rendering with source links. Bound value expansion depth and represent cycles, unavailable or opaque values honestly.
  4. Provide the same provenance/value representation to indexing, rename and debugging. Generated names with no reliable editable origin remain navigable but not automatically renameable.

Failure behavior and constraints

Unsupported proposals or compiler limitations produce capability errors, not downgraded lexical answers. Avoid replacing compiler-dependent std::meta facilities with guessed host evaluation. Instantiated/generated source locations may be incomplete; preserve the chain and explicitly indicate gaps.

Acceptance scenarios

  1. Use real Void enum helpers, generated data members, dependent splices, expansion statements and template/module combinations.
  2. Verify reflected values, original declaration links, synthesized members and invalid-code recovery across edits.
  3. Exercise ambiguous/generated name rename rejection, value cycles/size limits, serialization round trips and stable entity identities within a snapshot.

Verification and integration

Proposed NEW CTest label: reflection. Once implemented, register a nonzero suite and run:

dev cpp-gcc -c ctest --test-dir build/bootstrap -L reflection --output-on-failure

This future command is not evidence that the label/tests exist now. Before dispatch, bind the fixtures above to actual targets and record prerequisites/side effects. Require fresh independent review of the implemented contract and affected integrations. Version the provenance/value schema and invalidate derived index/trace renderers on incompatible changes. Retain source snapshots and mark older unsupported renderings rather than fabricate origins.