Repository navigation
psi: select generic and applied conformance members through static binders - #6316
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)orE::pick::<4>(x)), and supplying a generic member through a selection row (Keep::keep = hold;withmachine hold<T>) now compile, check, and agree on Psi and native execution.Previously each of the three paths stopped at a different stage:
Operand::readinstatic_operand_binding/mod.rs,static_record_source_receiverinevidence.rs,selected_record_call_operandincallable_signature_shapes.rs, andconst_argumentindeclare.rscompared 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_recordsnow 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 viastatic_record_schema_in_frame.E::keep::<u8>orE::pick::<4>),substitute_argumentscleared 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_argumentsnow resets copied closed requirement targets to their template so stage 04 re-prepares them in the specialized caller's scope;named_conformance_call_memberallows retained local bindings on closed requirement calls;record_requirement_signature,static_value_arguments, andStaticRecordRequirementInstanceretain each closed requirement's own signature symbol so distinct applications (such asE::pick::<4>andE::pick::<5>) stay separate in checking.read/machine.rs,requirement_bodyfell through toself.machine(symbol)for a reference row's free machine, reading it asReading::Closedwhen checking a generic witness (self.rigid = true), andwitnessedkept the unapplied requirement template when a specialized free machine had no owning conformance. Both now read the generic template underReading::Implementationand resolve the closed requirement header for specialized reference rows. In stage 02,initializer_dependencies.rsalso resolves reference rows viarow.realization_machineinstead 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-depson all 7 touched crates clean,mbx xtask fmt --check --base origin/main,mbx xtask check-boundary,mbx xtask check-rulesclean, andomega run --engine native/--engine psion 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