crates.sage_ir.resolution.lookup.completeness

Negative reasoning requires explicit completeness. A resolution result preserves every represented alternative separately from the fact that the searched source is exhaustive. An empty incomplete result is never interpreted as proof that the name or provider does not exist. This is the resolution consequence of Incompleteness is an explicit terminal outcome.

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

Implementation

Implemented crates/sage-ir/src/check/method.rs:51–56

sage_ir::check::method · lib:sage_ir

Method-provider completeness is tracked independently of represented candidates.

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.resolution.lookup.completeness`
    // Method-provider completeness is tracked independently of represented candidates.
    let (traits, scope_complete) = resolver.traits_in_method_scope();
    let mut definite = Vec::new();
    let bound_provider_unknown = cx.has_unhandled_method_bound_providers(receiver_ty);
    let inherent_provider_unknown =

}

See more source ↗

Implemented crates/sage-ir/src/check/resolve/mod.rs:251–256

sage_ir::check::resolve · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.resolution.lookup.completeness`
    pub(crate) fn traits_in_method_scope(&mut self) -> (Vec<(TraitSymbol<'db>, bool)>, bool) {
        let mut traits = Vec::new();
        let mut complete = match self.module() {
            ModSymbol::Local(module) => {
                crate::local_syms::mods::module_expansion_complete_for_method_providers(

}

See more source ↗

Implemented crates/sage-ir/src/local_syms/mods.rs:542–547

sage_ir::local_syms::mods · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.resolution.lookup.completeness`
pub(crate) fn module_expansion_complete_for_method_providers<'db>(
    db: &'db dyn Db,
    module: LocalModSym<'db>,
) -> bool {
    module_expansion_complete(db, module, ExpansionCompleteness::MethodProviders)

}

See more source ↗

TODO crates/sage-meta/tests/semantic_spec.rs:9–14

sage_meta::todo · test:semantic_spec

TODO: Resolution returns represented alternatives, but a uniform explicit completeness result across all lookup forms is not implemented. TODO: Complete the claim-specific verification matrix:

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.resolution.lookup.completeness`
    // TODO: Resolution returns represented alternatives, but a uniform explicit completeness result across all lookup forms is not implemented.
    #[test]
    #[sage::test(crates.sage_ir.resolution.lookup.completeness)]
    fn resolution_lookup_completeness() {
        // 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::resolution_lookup_completeness

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

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_ir.resolution.lookup.completeness)]
    fn resolution_lookup_completeness() {
        // TODO: Complete the claim-specific verification matrix:
        // Focused fixtures distinguish absent, uniquely resolved, ambiguous, and incomplete lookup,
        // including an incomplete empty provider set, and demonstrate that only the exhaustive empty case
        // permits a definitive negative conclusion.
    }
}

See more source ↗

Implemented sage_test_harness::derive_expansion_tests::unresolved_item_macro_keeps_method_scope_incomplete

crates/sage-test-harness/src/lib.rs · lib:sage_test_harness

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_ir.resolution.lookup.completeness)]
    fn unresolved_item_macro_keeps_method_scope_incomplete() {
        with_test_crate_files_using_db(
            Database::new(BuiltinDeriveTcx::default()),
            &[(
                "lib.rs",
                "unknown_items!();\n#[derive(Clone)]\nstruct Db { shared: bool }\nstruct DbDropGuard { db: Db }\nimpl DbDropGuard { fn db(&self) -> Db { self.db.clone() } }",
            )],
            |db, root| {
                let checked = root
                    .expanded_module_items(db)
                    .iter()
                    .filter_map(|symbol| {
                        let SymbolData::ImplSymbol(ImplSymbol::Local(local_impl)) = symbol.data(db)
                        else {
                            return None;
                        };
                        Some(local_impl.items(db))
                    })
                    .flat_map(|items| {
                        items.stash()[items.root().value]
                            .iter()
                            .copied()
                            .collect::<Vec<_>>()
                    })
                    .find_map(|item| {
                        let sage_ir::ty::TraitItemDef::Function(FnSymbol::Local(function)) = item
                        else {
                            return None;
                        };
                        (function.name(db).text(db) == "db").then(|| function.body(db))
                    })
                    .expect("DbDropGuard::db method");
                assert!(checked.diagnostics.iter().any(|diagnostic| {
                    diagnostic
                        .message
                        .contains("incomplete candidate information")
                }));
            },
        );
    }
}

Conditional source: #[cfg(test)]

See more source ↗

Review: Accepted · macro_fix_precedence/completeness.

Reviewed the full completeness claim, three ordinary implementation associations (method.rs, resolve/mod.rs, local_syms/mods.rs), the explicit TODO implementation association, and both associated test entries. Captured test setup and relevant BuiltinDeriveTcx metadata context. This anchor remains partially implemented and partially tested; the TODO is essential to that assessment.

The claim requires represented alternatives and exhaustiveness to remain separate, and forbids treating an incomplete empty source as a definitive negative. traits_in_method_scope returns represented trait identities, per-provider definite-scope flags, and a separate scope-complete boolean. It retains represented traits while marking uncertainty for failed imports, local-glob provider enumeration, missing or ambiguous edition preludes, and incomplete module expansion. local_syms/mods.rs checks unresolved/unsupported/depth-limited bang expansion, active attributes, parse errors and applicable derive handling rather than equating the finite expanded-item vector with a complete directory. Method-provider completeness has its own policy. Thus the source of uncertainty remains independent of candidates which expansion already produced.

method.rs consumes that pair: unknown starts from !scope_complete plus unhandled bound/inherent providers; unsupported signatures and Maybe trait goals preserve unknown instead of becoming No. Definite candidates are accumulated separately. Selection requires exactly one definite candidate and !unknown. Multiple definite candidates yield ambiguity; otherwise unknown yields the explicit incomplete-candidate diagnostic; only the remaining exhaustive zero-candidate branch reports no applicable method. The external-inherent path checks completeness before treating an empty candidate list as absence. The changed generated import-root audit in resolve/mod.rs compares identities/provenance and leaves these completeness propagation paths intact.

The ordinary test unresolved_item_macro_keeps_method_scope_incomplete visibly supplies unknown_items! alongside a Clone-derived type and checks the selected method body for an incomplete-candidate-information diagnostic. It exercises a represented candidate together with an unresolved expansion, detecting the common error of selecting a known candidate while ignoring possible missing providers. It does not prove the incomplete-empty case or the complete absent/unique/ambiguous matrix. Its assertion checks diagnostic presence, not exclusivity; that limitation is not treated as exhaustive coverage.

The TODO implementation entry explicitly states that a uniform completeness result across all lookup forms is not implemented; ordinary resolve_path still returns alternatives alone. The TODO test explicitly requires absent, unique, ambiguous and incomplete fixtures, particularly incomplete empty provider sets and exhaustive-empty negative reasoning. This adequately accounts for the remaining broad claim instead of pretending the method-provider slice satisfies every lookup form. Completing it requires a common explicit result protocol and targeted assertions across those states. There are no N/A entries.

Executed cargo test -p sage-test-harness --lib unresolved_item_macro_keeps_method_scope_incomplete: one test passed, 144 filtered out, with existing compiler warnings. This execution supplements source review only for that scenario. No production or test sources changed. No requested edits; accepted deferrals remain visibly TODO.

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