0%

Resolver: single constructor-binding descriptor

Goal

The import resolver decides the binding once and emits it as a constructor-binding descriptor in ResolvedImports (imported type ref, kind struct/newtype/sum-variant, local aliased name, resolved visibility). This is the parity carrier every backend consumes rather than re-deriving from the provider AST.

Implementation Sketch

Add the descriptor struct + ResolvedImports field (compiler/oric/src/imports/mod.rs). Extend push_item_imports classification: a name matching a pub type -> type/newtype descriptor; a name matching a provider sum type’s variant -> a NEW variant-inventory classification dimension (a variant is in neither the function nor the type inventory). Within-rank collision errors (cross-provider, intra-provider variant duplication, variant-vs-other-item) with as-alias disambiguation. :: private-access visibility per Clause 18.4.1.

Spec References

Proposal Semantics (Backend neutrality descriptor); Error Handling (collisions + as); Drawbacks (fourth classification dimension); Clause 18.7 within-rank collision rule; Clause 18.4.1 :: visibility.

Work Items

  • Constructor-binding descriptor struct + imported_constructors field on ResolvedImports, carrying imported-type ref, kind, local name, resolved visibility.
  • Extend push_item_imports with the variant-inventory classification dimension + within-rank collision errors (cross-provider / intra-provider variant duplication / variant-vs-item), as-disambiguated; :: visibility for private types/variants.