Skip to content

psi: select generic and applied conformance members through static binders - #6316

Merged
Smotto merged 1 commit into
mainfrom
work/psi-static-binder-members
Nov 27, 2026
Merged

Smotto merged 1 commit into
mainfrom
work/psi-static-binder-members

Conversation

@Smotto

@Smotto Smotto commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Calling a conformance member through a static record binder that another type parameter applies (machine use_map<T, const E: Render<T>>(x: T) -> bool { E::paint(x) }), calling a generic member through a static record binder (E::keep::<u8>(x) or E::pick::<4>(x)), and supplying a generic member through a selection row (Keep::keep = hold; with machine hold<T>) now compile, check, and agree on Psi and native execution.

Previously each of the three paths stopped at a different stage:

  • Static record binders applied by another parameter. Operand::read in static_operand_binding/mod.rs, static_record_source_receiver in evidence.rs, selected_record_call_operand in callable_signature_shapes.rs, and const_argument in declare.rs compared the binder's declared schema (Render<T>) directly against the concrete conformance (Red satisfies Render<u8>) without substituting the call's other static arguments (T -> u8). Operand::require_static_records now instantiates the declared schema with the full application tuple after all operands are read, and the receiver/publication checks instantiate the schema in the enclosing specialization frame via static_record_schema_in_frame.
  • Generic members called through a static record binder. When stage 04 copied a generic machine containing a closed requirement call (E::keep::<u8> or E::pick::<4>), substitute_arguments cleared the copied application's bindings without resetting the call target back to the requirement template, so stage 05 rejected the call as having an incomplete bound argument tuple. substitute_arguments now resets copied closed requirement targets to their template so stage 04 re-prepares them in the specialized caller's scope; named_conformance_call_member allows retained local bindings on closed requirement calls; record_requirement_signature, static_value_arguments, and StaticRecordRequirementInstance retain each closed requirement's own signature symbol so distinct applications (such as E::pick::<4> and E::pick::<5>) stay separate in checking.
  • Selection rows of generic members. In read/machine.rs, requirement_body fell through to self.machine(symbol) for a reference row's free machine, reading it as Reading::Closed when checking a generic witness (self.rigid = true), and witnessed kept the unapplied requirement template when a specialized free machine had no owning conformance. Both now read the generic template under Reading::Implementation and resolve the closed requirement header for specialized reference rows. In stage 02, initializer_dependencies.rs also resolves reference rows via row.realization_machine instead of demanding an owned inline realization.

The completed sub-bullet under STATIC-MACHINE-MIGRATION is deleted from TASKS.md.

Gate: RC-SOURCE-SEMANTICS | select conformance members through type-applied static record binders, call generic members through static record binders, and supply generic members via selection rows
Spec: wiki/spec/language/conformances.md#declaration-and-selection, wiki/spec/language/generics.md#generic-machine-requirements
Proof: mbx test -p source-compiler --features test-support --test checking_requirement_interfaces --test checking_indexed_and_member_contracts (12 + 18 passed), mbx test -p typed-trees-to-prepared-typed-trees --lib -- specialization (48 passed), mbx test -p terminal-check-tables --lib (13 passed), mbx test -p lowered-program-to-checked-program --lib -- boundary_calls (84 passed), mbx clippy --no-deps on all 7 touched crates clean, mbx xtask fmt --check --base origin/main, mbx xtask check-boundary, mbx xtask check-rules clean, and omega run --engine native / --engine psi on Windows x86_64 agree on positive (native exit 0 / Psi exit 0) and trap negative twin (native exit -1073741795 / Psi crash: Trap) | clean. Not run: Linux, macOS.
Agent: Antigravity | Model: unknown | Effort: high | Tokens: 20.07M in (19.69M cached), 68.4k out | Steps: 100 | Time: 40m54s | Steers: 0

…nders

Calling a conformance member through a static record binder that another type parameter applies (`machine use_map<T, const E: Render<T>>(x: T) -> bool { E::paint(x) }`), calling a generic member through a static record binder (`E::keep::<u8>(x)` or `E::pick::<4>(x)`), and supplying a generic member through a selection row (`Keep::keep = hold;` with `machine hold<T>`) now compile, check, and agree on Psi and native execution.

Previously each of the three paths stopped at a different stage:
- **Static record binders applied by another parameter.** `Operand::read` in `static_operand_binding/mod.rs`, `static_record_source_receiver` in `evidence.rs`, `selected_record_call_operand` in `callable_signature_shapes.rs`, and `const_argument` in `declare.rs` compared the binder's declared schema (`Render<T>`) directly against the concrete conformance (`Red satisfies Render<u8>`) without substituting the call's other static arguments (`T -> u8`). `Operand::require_static_records` now instantiates the declared schema with the full application tuple after all operands are read, and the receiver/publication checks instantiate the schema in the enclosing specialization frame via `static_record_schema_in_frame`.
- **Generic members called through a static record binder.** When stage 04 copied a generic machine containing a closed requirement call (`E::keep::<u8>` or `E::pick::<4>`), `substitute_arguments` cleared the copied application's bindings without resetting the call target back to the requirement template, so stage 05 rejected the call as having an incomplete bound argument tuple. `substitute_arguments` now resets copied closed requirement targets to their template so stage 04 re-prepares them in the specialized caller's scope; `named_conformance_call_member` allows retained local bindings on closed requirement calls; `record_requirement_signature`, `static_value_arguments`, and `StaticRecordRequirementInstance` retain each closed requirement's own signature symbol so distinct applications (such as `E::pick::<4>` and `E::pick::<5>`) stay separate in checking.
- **Selection rows of generic members.** In `read/machine.rs`, `requirement_body` fell through to `self.machine(symbol)` for a reference row's free machine, reading it as `Reading::Closed` when checking a generic witness (`self.rigid = true`), and `witnessed` kept the unapplied requirement template when a specialized free machine had no owning conformance. Both now read the generic template under `Reading::Implementation` and resolve the closed requirement header for specialized reference rows. In stage 02, `initializer_dependencies.rs` also resolves reference rows via `row.realization_machine` instead of demanding an owned inline realization.

The completed sub-bullet under **STATIC-MACHINE-MIGRATION** is deleted from `TASKS.md`.

Gate: RC-SOURCE-SEMANTICS | select conformance members through type-applied static record binders, call generic members through static record binders, and supply generic members via selection rows
Spec: wiki/spec/language/conformances.md#declaration-and-selection, wiki/spec/language/generics.md#generic-machine-requirements
Proof: `mbx test -p source-compiler --features test-support --test checking_requirement_interfaces --test checking_indexed_and_member_contracts` (12 + 18 passed), `mbx test -p typed-trees-to-prepared-typed-trees --lib -- specialization` (48 passed), `mbx test -p terminal-check-tables --lib` (13 passed), `mbx test -p lowered-program-to-checked-program --lib -- boundary_calls` (84 passed), `mbx clippy --no-deps` on all 7 touched crates clean, `mbx xtask fmt --check --base origin/main`, `mbx xtask check-boundary`, `mbx xtask check-rules` clean, and `omega run --engine native` / `--engine psi` on Windows x86_64 agree on positive (`native exit 0` / `Psi exit 0`) and trap negative twin (`native exit -1073741795` / `Psi crash: Trap`) | clean. Not run: Linux, macOS.
Agent: Antigravity | Model: unknown | Effort: high | Tokens: 20.07M in (19.69M cached), 68.4k out | Steps: 100 | Time: 40m54s | Steers: 0
@Smotto
Smotto merged commit 20872db into main Nov 27, 2026
1 check passed
@Smotto
Smotto deleted the work/psi-static-binder-members branch November 27, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant