Repository navigation
psi: select a boundary trait's operator slot from its token - #8596
Merged
Merged
Conversation
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
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.
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, buta == bwas 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_providerrow, 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_routenow compiles. It used a top-levelboundary machine ==with asatisfiesmachine, a form the parser now retires. It now declares a one-member boundary trait, aCheckedimplementation andselect_providerrows. Its operands takeas +Compared/as -Comparedcasts.may_crashnow publishes thecrashes? Traproute it propagates.operator_requires_effectsgets 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 withcanonical operation evidence: cannot attach obligation evidence: UnownedSeal. The named callInteger::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 == righttargetsequal; a second matching boundary slot is refused asOperatorAmbiguous).mbx test -p symbol-resolved-trees-to-typed-treespasses (239).mbx clippy -p typed-trees -p symbol-resolved-trees-to-typed-trees --all-targets -- -D warningsis clean.mbx xtask sample-gate --exact --filter samples/cli/probes/boundary_crash_routecompiles (a probe without an oracle); droppingcrashes? Trapfrommay_crashis refused for the uncovered route.operator_requires_effectsstops at the native evidence error above | that error is separate from this changeAgent: 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