crates.sage_ir.checking.body.operator_calls

Overloadable operators remain resolved calls in Typed IR. Every non-short-circuit binary operator retains its trait operation and method result through inference; its token alone neither narrows nor equates operand types. Every proven operation completes as a resolved trait-method call, including primitive and generic cases. Ambiguity and unsupported operands cannot be represented as success, and primitive specialization occurs only at the future codegen boundary defined by the operator representation decision.

Read in specification context · design/crates/sage_ir/checking.sage

Implementation

Implemented crates/sage-ir/src/check/expr.rs:24–29

sage_ir::check::expr · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.body.operator_calls`
    pub(crate) async fn check_with(
        &self,
        cx: &InferCtx<'_, 'db>,
        scope: &Scope<'db>,
    ) -> Ptr<TyExpr<'db>> {

}

See more source ↗

Implemented crates/sage-ir/src/check/finalize.rs:319–324

sage_ir::check::finalize · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.body.operator_calls`
    // {anchor}`crates.sage_ir.types.calls.selected_semantics`
    // {anchor}`crates.sage_ir.types.operators.trait_calls`
    fn copy_call_target(&mut self, target: ResolvedCallTarget<'db>) -> ResolvedCallTarget<'db> {
        let ResolvedCallTarget {
            function,

}

See more source ↗

Implemented crates/sage-ir/src/check/infer/obligations.rs:84–89

sage_ir::check::infer::obligations · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.body.operator_calls`
    pub fn same_dedup_key(&self, other: &Self) -> bool {
        matches!(self.goal, ObligationGoal::Prove(_))
            && matches!(other.goal, ObligationGoal::Prove(_))
            && self.recoveries == other.recoveries
            && self.canonical_goal == other.canonical_goal

}

See more source ↗

Implemented crates/sage-ir/src/check/infer_ctx.rs:2140–2145

sage_ir::check::infer_ctx · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.body.operator_calls`
    fn recover_expr_slots(&self, recoveries: &[ObligationRecovery<'db>], error: ErrorReported) {
        let error_ty = self.alloc_ty(Ty::Error(error));
        for recovery in recoveries {
            let original = self.expr_slots.borrow()[recovery.slot.0 as usize]
                .expect("obligation expression slot must be filled before solving");

}

See more source ↗

Implemented crates/sage-ir/src/check/operator.rs:22–27

sage_ir::check::operator · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.checking.body.operator_calls`
// {anchor}`crates.sage_ir.inference.numeric_domains`
pub(crate) fn check_binary_operator<'db>(
    cx: &InferCtx<'_, 'db>,
    scope: &Scope<'db>,
    operation: BinaryOp,

}

See more source ↗

TODO crates/sage-meta/tests/semantic_spec.rs:436–441

sage_meta::todo · test:semantic_spec

TODO: Generic operator bodies and unknown-Self candidate hints remain incomplete. TODO: Complete the claim-specific verification matrix:

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.body.operator_calls`
    // TODO: Generic operator bodies and unknown-Self candidate hints remain incomplete.
    #[test]
    #[sage::test(crates.sage_ir.checking.body.operator_calls)]
    fn checking_body_operator_calls() {
        // TODO: Complete the claim-specific verification matrix:

}

See more source ↗

Tests and review

Indexed tests and the implementation-completeness and test-adequacy review; no test run is implied.

TODO sage_meta::todo::checking_body_operator_calls

crates/sage-meta/tests/semantic_spec.rs · test:semantic_spec

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_ir.checking.body.operator_calls)]
    fn checking_body_operator_calls() {
        // TODO: Complete the claim-specific verification matrix:
        // Table-driven checks cover every represented operator-to-trait mapping, including different
        // integer types for shift operands. Query traces show primitive proofs loading ordinary `core`
        // impl identities and headers from external metadata, with no synthetic primitive candidate.
        // Source-driven tests and independent rustc oracle cases cover representative positive and
        // negative expressions; concrete primitive, generic, nonnumeric shift, and user-defined calls;
        // non-`Self` `Rhs` and `Output`; preservation of `Any` domains before proof selection; lazy
        // boolean short-circuit nodes; and rejection of `1 + true`.
    }
}

See more source ↗

Review: Accepted · Codex /root/anchor_094.

Reviewed the complete operator_calls claim, all six implementation associations, and the sole TODO test entry. Captured the checking design, operator representation RFD and well-known method lookup dependency. Source inspection only; no suites were rerun and no source changes were made.

The claim requires all non-short-circuit binary tokens to retain trait/method semantics through inference, with no token-only operand narrowing/equality; proven primitive and generic cases finish as resolved trait calls, ambiguous/unsupported cases cannot succeed, and primitive specialization is deferred to codegen. The RFD explicitly distinguishes lazy boolean control flow from overloadable operators and reserves scalar lowering for future codegen.

expr.rs routes binary expressions to check_binary_operator. operator.rs excludes And/Or into a bool-checked Binary node and maps every other represented token to a well-known method. The captured lookup resolves ordinary core trait paths and member function identities. The operator checker imports the actual signature with separate left/right type arguments, validates its owner predicate and return projection or bool result, and creates a provisional ResolvedCall containing function identity, static trait dispatch, owner/method arguments and adjusted operands. It submits proof/normalization obligations tied to an expression slot rather than accepting a token as a primitive operation. Probes discard speculative equalities; operand adjustment relates against the method signature, not an unconditional left-equals-right rule. In particular the shape preserves separate Self/Rhs and projected Output instead of assuming they coincide.

infer_ctx.rs attaches recoveries to retained obligations and replaces a failed operation's slot with a diagnosed Error expression, including recovery of a still-inferred result type. Unsupported metadata/signature forms are diagnosed directly in operator.rs. obligations.rs includes recovery scope, canonical goal and mapping in deduplication and limits it to proof goals, avoiding accidental normalization-output or expression-recovery sharing. finalize.rs resolves slots and copies ResolvedCall targets, dispatch Self/trait references and both argument lists into finalized storage; it does not specialize primitive calls back to scalar operator nodes. These are meaningful implementation mechanisms, but they do not establish complete candidate discovery, generic support or every negative-case behavior.

The implementation TODO explicitly states generic operator bodies and unknown-Self candidate hints remain incomplete. The sole associated test checking_body_operator_calls has no assertions and intentionally defers the full matrix: every operator mapping, differing shift operand types, ordinary core primitive impl metadata traces without synthetic candidates, source-driven positive/negative and independent oracle cases, primitive/generic/nonnumeric-shift/user-defined calls, non-Self Rhs/Output, Any-domain preservation before proof selection, lazy boolean forms and rejection of 1 + true. Its prerequisite is completion of the named missing implementation slices and association/review of that matrix. An unassociated local mapping unit test exists in the implementation file, but is not substituted for the associated comprehensive evidence. No runtime coverage or universal operator completeness is claimed. All implementation entries and requirements remain accounted for with the explicit implementation/evidence deferrals preserved, and no additional concrete edits are requested.

Browse crates anchors

139 anchors

Specification anchors and declared coverage
AnchorImplementationTests
crates (139)114 Implemented37 TODO2 N/A74 Implemented107 TODO
crates.sage_inspector (15)13 Implemented1 TODO2 N/A3 Implemented15 TODO
crates.sage_inspector.inspection (15)13 Implemented1 TODO2 N/A3 Implemented15 TODO
balanced_tracesImplementedTODO
canonical_ownershipImplementedImplementedTODO
derive_reflectionImplementedImplementedTODO
detail_free_indexImplementedTODO
deterministic_traceImplementedTODO
durable_navigationN/ATODO
generic_browserN/ATODO
owned_reflectionImplementedImplementedTODO
product_availabilityImplementedTODO
revision_and_demandImplementedTODO
semantic_phase_boundaryImplementedTODO
source_evidenceImplementedTODO
typed_serviceImplementedTODO
unknown_workImplementedTODOTODO
workspace_actorImplementedTODO
crates.sage_ir (90)67 Implemented34 TODO40 Implemented88 TODO
crates.sage_ir.checking (12)12 Implemented3 TODO5 Implemented12 TODO
crates.sage_ir.checking.body (5)5 Implemented2 TODO3 Implemented5 TODO
elaborationImplementedImplementedTODO
expected_typesImplementedTODOTODO
interface_dependenciesImplementedImplementedTODO
isolated_completionImplementedImplementedTODO
operator_callsImplementedTODOTODO
identity_mintingImplementedTODO
owned_productsImplementedImplementedTODO
crates.sage_ir.checking.signature (4)4 Implemented1 TODO1 Implemented4 TODO
body_independenceImplementedTODO
narrow_detailImplementedTODOTODO
owner_binderImplementedImplementedTODO
storageImplementedTODO
symbol_keyed_interfacesImplementedTODO
crates.sage_ir.crate (9)9 TODO9 TODO
explicit_restrictionsTODOTODO
identity_before_detailTODOTODO
incremental_evidenceTODOTODO
narrow_demandsTODOTODO
reexecution_and_invalidationTODOTODO
represented_completenessTODOTODO
restrictions_and_gapsTODOTODO
semantic_query_boundariesTODOTODO
terminal_incompletenessTODOTODO
crates.sage_ir.inference (8)8 Implemented6 Implemented8 TODO
atomic_checkingImplementedImplementedTODO
body_local_quiescenceImplementedImplementedTODO
canonical_boundaryImplementedImplementedTODO
completed_body_boundaryImplementedTODO
numeric_domainsImplementedImplementedTODO
subtyping_and_coercionImplementedImplementedTODO
terminal_obligationsImplementedTODO
transaction_isolationImplementedImplementedTODO
crates.sage_ir.metadata (4)4 Implemented1 TODO4 TODO
explicit_incompletenessImplementedTODO
keyed_reuseImplementedTODOTODO
product_boundariesImplementedTODO
provider_authorityImplementedTODO
crates.sage_ir.modules (8)7 Implemented1 TODO4 Implemented8 TODO
crates.sage_ir.modules.expand (4)4 Implemented2 Implemented4 TODO
completenessImplementedImplementedTODO
dependenciesImplementedTODO
direct_membersImplementedTODO
recursion_and_fixpointImplementedImplementedTODO
crates.sage_ir.modules.parse (4)3 Implemented1 TODO2 Implemented4 TODO
dependenciesImplementedTODO
detail_firewallImplementedImplementedTODO
recovery_completenessTODOTODO
syntax_identitiesImplementedImplementedTODO
crates.sage_ir.resolution (5)5 Implemented1 TODO3 Implemented4 TODO
crates.sage_ir.resolution.lookup (5)5 Implemented1 TODO3 Implemented4 TODO
completenessImplementedTODOImplementedTODO
dependenciesImplementedTODO
expansion_import_ambiguityImplementedImplemented
identity_onlyImplementedTODO
precedenceImplementedImplementedTODO
crates.sage_ir.solver (9)7 Implemented7 TODO5 Implemented9 TODO
alternative_isolationImplementedTODOImplementedTODO
bounded_completenessImplementedTODOTODO
candidate_completenessImplementedTODO
canonical_cyclesTODOTODO
canonical_outputsImplementedImplementedTODO
local_index_firewallTODOTODO
normalization_demandImplementedTODOImplementedTODO
schedule_independenceImplementedTODOImplementedTODO
shared_final_resultImplementedTODOImplementedTODO
crates.sage_ir.symbols (8)8 Implemented4 Implemented7 TODO
associated_identityImplementedImplemented
associated_interfacesImplementedTODO
body_interfacesImplementedImplementedTODO
definition_identityImplementedTODO
external_fact_queriesImplementedTODO
external_identityImplementedTODO
kind_wrappersImplementedImplementedTODO
local_identityImplementedImplementedTODO
crates.sage_ir.types (27)16 Implemented12 TODO13 Implemented27 TODO
crates.sage_ir.types.aliases (2)1 Implemented1 TODO1 Implemented2 TODO
identityImplementedImplementedTODO
revelationTODOTODO
crates.sage_ir.types.binder (1)1 Implemented1 TODO1 Implemented1 TODO
owner_parametersImplementedTODOImplementedTODO
crates.sage_ir.types.body (13)4 Implemented9 TODO3 Implemented13 TODO
awaitTODOTODO
closuresTODOTODO
conditional_patternsTODOTODO
coroutinesTODOTODO
diagnosed_recoveryImplementedImplementedTODO
elaboratedTODOImplementedTODO
for_iterationTODOTODO
indexingTODOTODO
macro_expansionTODOTODO
no_inferenceImplementedImplementedTODO
resolved_referencesImplementedTODO
try_residualTODOTODO
typed_provenanceImplementedTODO
crates.sage_ir.types.calls (2)1 Implemented1 TODO1 Implemented2 TODO
dispatch_familiesTODOTODO
selected_semanticsImplementedImplementedTODO
crates.sage_ir.types.lifetimes (2)2 Implemented2 Implemented2 TODO
dummyImplementedImplementedTODO
unchecked_borrowsImplementedImplementedTODO
crates.sage_ir.types.operators (2)2 Implemented1 Implemented2 TODO
lazy_control_flowImplementedTODO
trait_callsImplementedImplementedTODO
scoped_identitiesImplementedTODO
crates.sage_ir.types.spans (4)4 Implemented4 Implemented4 TODO
generated_identityImplementedImplementedTODO
item_originImplementedImplementedTODO
offset_reuseImplementedImplementedTODO
relative_compositionImplementedImplementedTODO
crates.sage_oracle_harness (4)4 Implemented2 TODO1 Implemented4 TODO
crates.sage_oracle_harness.crate (4)4 Implemented2 TODO1 Implemented4 TODO
deterministic_emissionImplementedTODO
exact_comparisonImplementedTODOImplementedTODO
fixed_projectionImplementedTODO
independent_coverageImplementedTODOTODO
crates.sage_stash (5)5 Implemented5 Implemented
crates.sage_stash.storage (5)5 Implemented5 Implemented
handle_ownershipImplementedImplemented
immutable_entriesImplementedImplemented
query_valueImplementedImplemented
rooted_equalityImplementedImplemented
typed_interningImplementedImplemented
crates.sage_test_harness (25)25 Implemented25 Implemented
crates.sage_test_harness.compile_tests (25)25 Implemented25 Implemented
annotation_validationImplementedImplemented
blessing_gateImplementedImplemented
callsite_updatesImplementedImplemented
checking_scopeImplementedImplemented
compiler_conditionsImplementedImplemented
completed_typesImplementedImplemented
coordinatesImplementedImplemented
dependenciesImplementedImplemented
diagnostic_countsImplementedImplemented
diagnostic_locationsImplementedImplemented
editionImplementedImplemented
fixturesImplementedImplemented
grouped_observationsImplementedImplemented
invocationImplementedImplemented
production_executionImplementedImplemented
project_isolationImplementedImplemented
query_captureImplementedImplemented
query_projectionImplementedImplemented
renderingImplementedImplemented
resolved_symbolsImplementedImplemented
review_visibilityImplementedImplemented
rustc_executionImplementedImplemented
rustc_lintsImplementedImplemented
starting_expressionsImplementedImplemented
target_lineImplementedImplemented