Skip to content

psi: select a boundary trait's operator slot from its token - #8596

Merged
Smotto merged 1 commit into
mainfrom
claude/project-thread-1yciag
Dec 4, 2026
Merged

Smotto merged 1 commit into
mainfrom
claude/project-thread-1yciag

Conversation

@Smotto

@Smotto Smotto commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Requested by Jarod · project thread

What

An operator declared on a boundary trait could only be called by name. Given
boundary trait Comparison { machine == equal(left: i32 in Compared, right: i32 in Compared) -> bool reaches none; },
the call Comparison::equal(a, b) worked, but a == b was refused with "builtin operator == requires unqualified operands". A boundary operation that needs provider selection is spelled this way: the spec says it is "a boundary-trait requirement (using a one-member trait when it needs independent provider selection)", and "the token identifies the required operator slot". So without the token, no program could use a provider-selected operator through its syntax.

Operator selection now considers the token-bearing requirements of visible, non-generic boundary traits when no direct declaration and no static binder matches. The operator selects the requirement itself, the same target a named call selects. Provider planning then binds the realization from the Build's select_provider row, as it does for the named call. If two such requirements match one operand tuple, the operator is refused as ambiguous. Direct declarations and static binders are selected exactly as before.

Two probes move to this spelling:

  • boundary_crash_route now compiles. It used a top-level boundary machine == with a satisfies machine, a form the parser now retires. It now declares a one-member boundary trait, a Checked implementation and select_provider rows. Its operands take as +Compared / as -Compared casts. may_crash now publishes the crashes? Trap route it propagates.
  • operator_requires_effects gets the same rewrite, plus a local for the effect-bearing operand, which needs an expected result domain. It now passes checking. It then stops in the native build with canonical operation evidence: cannot attach obligation evidence: UnownedSeal. The named call Integer::equal(prepared, held) stops the same way, so that failure is not from this change.

Why

Found while getting the M to R sample shard green.

Gate: RC-SOURCE-SEMANTICS | a boundary trait's operator token selects its provider-supplied requirement
Spec: wiki/spec/language/expressions.md#executable-supply
Proof: new a_boundary_trait_token_selects_its_requirement (stage 03: left == right targets equal; a second matching boundary slot is refused as OperatorAmbiguous). mbx test -p symbol-resolved-trees-to-typed-trees passes (239). mbx clippy -p typed-trees -p symbol-resolved-trees-to-typed-trees --all-targets -- -D warnings is clean. mbx xtask sample-gate --exact --filter samples/cli/probes/boundary_crash_route compiles (a probe without an oracle); dropping crashes? Trap from may_crash is refused for the uncovered route. operator_requires_effects stops at the native evidence error above | that error is separate from this change

Agent: Claude Code | Model: claude-opus-5-5 | Effort: low | Tokens: unavailable in (unavailable cached), unavailable out | Steps: unavailable | Time: unavailable | Steers: 0


Generated by Claude Code

An operator declared on a boundary trait could only be called by name. Given
`boundary trait Comparison { machine == equal(left: i32 in Compared, right: i32 in Compared) -> bool reaches none; }`,
the call `Comparison::equal(a, b)` worked, but `a == b` was refused with "builtin operator `==` requires unqualified operands". A boundary operation that needs provider selection is spelled this way: the spec says it is "a boundary-trait requirement (using a one-member trait when it needs independent provider selection)", and "the token identifies the required operator slot". So without the token, no program could use a provider-selected operator through its syntax.

Operator selection now considers the token-bearing requirements of visible, non-generic boundary traits when no direct declaration and no static binder matches. The operator selects the requirement itself, the same target a named call selects. Provider planning then binds the realization from the Build's `select_provider` row, as it does for the named call. If two such requirements match one operand tuple, the operator is refused as ambiguous. Direct declarations and static binders are selected exactly as before.

Two probes move to this spelling:
- `boundary_crash_route` now compiles. It used a top-level `boundary machine ==` with a `satisfies` machine, a form the parser now retires. It now declares a one-member boundary trait, a `Checked` implementation and `select_provider` rows. Its operands take `as +Compared` / `as -Compared` casts. `may_crash` now publishes the `crashes? Trap` route it propagates.
- `operator_requires_effects` gets the same rewrite, plus a local for the effect-bearing operand, which needs an expected result domain. It now passes checking. It then stops in the native build with `canonical operation evidence: cannot attach obligation evidence: UnownedSeal`. The named call `Integer::equal(prepared, held)` stops the same way, so that failure is not from this change.

## Why

Found while getting the M to R sample shard green.

Gate: RC-SOURCE-SEMANTICS | a boundary trait's operator token selects its provider-supplied requirement
Spec: wiki/spec/language/expressions.md#executable-supply
Proof: new `a_boundary_trait_token_selects_its_requirement` (stage 03: `left == right` targets `equal`; a second matching boundary slot is refused as `OperatorAmbiguous`). `mbx test -p symbol-resolved-trees-to-typed-trees` passes (239). `mbx clippy -p typed-trees -p symbol-resolved-trees-to-typed-trees --all-targets -- -D warnings` is clean. `mbx xtask sample-gate --exact --filter samples/cli/probes/boundary_crash_route` compiles (a probe without an oracle); dropping `crashes? Trap` from `may_crash` is refused for the uncovered route. `operator_requires_effects` stops at the native evidence error above | that error is separate from this change

Agent: Claude Code | Model: claude-opus-5-5 | Effort: low | Tokens: unavailable in (unavailable cached), unavailable out | Steps: unavailable | Time: unavailable | Steers: 0
@Smotto Smotto self-assigned this Dec 4, 2026
@Smotto
Smotto merged commit 63593f6 into main Dec 4, 2026
1 check passed
@Smotto
Smotto deleted the claude/project-thread-1yciag branch December 4, 2026 05:33
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.

2 participants