Rust resolver: module-alias qualified calls (use a::b as lp; lp::foo()) stay unresolved although imports records alias = "lp" #367
Labels
No labels
code-review
correctness
dos
performance
security
severity/high
severity/low
severity/medium
tech-debt
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
h-dv/code-index#367
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Observed (0.37.1 /
8df22f69, dogfood oncode-index)In commit
8df22f69(PR #365), four exported functions were added tocrates/core/src/lang_profile.rsand called fromcrates/mcp-server/src/server.rsthrough a module import alias (use code_index_core::lang_profile as lp;atcrates/mcp-server/src/server.rs:3182):nearest_spellings(id: 564804,crates/core/src/lang_profile.rs:1088):changed_symbols(base="HEAD~1")reportsref_count: 2,direct_callers: 2,name_fallback_count: 2.find_references(symbol_id: 564804)shows the only 2resolvedrefs are unit tests insidecrates/core/src/lang_profile.rs(lines 1647, 1651).crates/mcp-server/src/server.rs(line 9014lp::nearest_spellings(...)and line 19945lp::nearest_spellings(...)) remain unresolved (resolution: "name_fallback",target_id: null,qualifier: "lp").lp::*calls incrates/mcp-server/src/server.rs:is_local_shaped(564800):ref_count: 4, name_fallback_count: 1filter_admits(564802):ref_count: 13, name_fallback_count: 2ambiguous_filter(564803):ref_count: 5, name_fallback_count: 1The index already holds the alias fact
get_dependencies(target="crates/mcp-server/src/server.rs", direction="out")returns:So
importsalready records that incrates/mcp-server/src/server.rs, qualifierlpaliasescode_index_core::lang_profile(one of the1,451refs counted byproject_overview.count_basis.alias_qualified_refs).Impact
context_pack(symbol_ids: [564804])lists only the unit testnearest_spellings_rank_related_local_ids_firstindependentsand omitscrates/mcp-server/src/server.rsfrom dependents (disclosed viaevidence_gaps.unfollowed_name_fallback: count: 2).change_impactandreview_diffcannot traverse acrosslp::*edges intocrates/mcp-server/src/server.rs.To check
crates/indexer/src/index.rs) can expand a single-segment qualifierqthrough the calling file'simportsrow whereimports.alias = q(rewritinglp→code_index_core::lang_profile/ suffixlang_profile) before matching candidate module paths, without introducing phantoms on the corpus suites.Fixed in v0.37.2 (PR #373, master
ccb77e68, release run 1144 green).rust_use_head_is_workspace, the same checkusepaths already use). The same-file and duplicate-alias gates are unchanged.tier1q_aliasbinds, all hand-checked correct.precision_gate7/7, phantom 0, with a new alias probe.find_callers(nearest_spellings)returns 4/4 resolved, including bothlp::calls inserver.rs.Not covered here, measured and left for later: prefix-qualified aliases (
lp::Type::f), and external-package aliases in other languages. Closing.