fix(cpp): workspace-wide dependent-base name resolution for cross-file templates#1586
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3 tasks
…upport) - Replace per-file `populateCppDependentBases(parsed)` with a workspace-wide `populateCppDependentBases(parsedFiles)` that builds a cross-file class index - Use qualified-name prefix for namespace disambiguation when multiple classes share a simple name (e.g. `Box` in two namespaces) - Move the call from `populateOwners` (per-file) to the new `populateWorkspaceOwners` hook so all files are processed before resolution runs - Add `cpp-two-phase-dependent-base-ns` fixture: Base<T> in a namespace in a separate file from Derived<T>, plus a namespace-free function with the same name — exercises the path where the class-owned filter does not apply - Add two integration tests for the new fixture" Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/d78fae8b-cd32-45d8-a815-2b27d7d89e62 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
…-phase-lookup Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/d78fae8b-cd32-45d8-a815-2b27d7d89e62 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix cross-file dependent-base name resolution in C++
fix(cpp): workspace-wide dependent-base name resolution for cross-file templates
May 14, 2026
Contributor
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This was referenced May 14, 2026
Merged
Merged
hohaivu
pushed a commit
to hohaivu/GitNexus
that referenced
this pull request
May 19, 2026
…e templates (abhigyanpatwari#1586) * Initial plan * fix(cpp): workspace-wide dependent-base name resolution (cross-file support) - Replace per-file `populateCppDependentBases(parsed)` with a workspace-wide `populateCppDependentBases(parsedFiles)` that builds a cross-file class index - Use qualified-name prefix for namespace disambiguation when multiple classes share a simple name (e.g. `Box` in two namespaces) - Move the call from `populateOwners` (per-file) to the new `populateWorkspaceOwners` hook so all files are processed before resolution runs - Add `cpp-two-phase-dependent-base-ns` fixture: Base<T> in a namespace in a separate file from Derived<T>, plus a namespace-free function with the same name — exercises the path where the class-owned filter does not apply - Add two integration tests for the new fixture" Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/d78fae8b-cd32-45d8-a815-2b27d7d89e62 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> * fix(cpp): clarify V1 conservative exact-prefix namespace match in two-phase-lookup Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/d78fae8b-cd32-45d8-a815-2b27d7d89e62 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Gergő Magyar <gergomagyar@icloud.com> Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
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.
populateCppDependentBasesresolved base-class simple names against the same file'slocalDefsonly. WhenBase<T>lives inbase.handDerived<T>inderived.h, the dependent-base nodeId set was always empty —isCppDependentBaseMembercould never suppress. The existing test passed accidentally because the class-ownedisFileLocalDeffilter blocked the same candidates first.Changes
cpp/two-phase-lookup.ts—populateCppDependentBases(parsed: ParsedFile)→populateCppDependentBases(parsedFiles: readonly ParsedFile[]). Builds a workspace-widesimpleName → {nodeId, nsPrefix}[]index across all files. Namespace disambiguation uses the qualified-name prefix (ns.ClassName→ prefixns): prefers same-namespace candidates when names collide, accepts unique matches, conservatively skips ambiguous cases (V1; cross-namespace and inline-namespace deferred).cpp/scope-resolver.ts— Removes the call frompopulateOwners(per-file); adds apopulateWorkspaceOwnershook so resolution runs after every file has been processed and all class defs are reachable.New fixture
cpp-two-phase-dependent-base-ns/—geom::Base<T>inbase.hwith a class methodcompute()and a namespace-free functioncompute()(noownerId; class-owned filter does not apply to it).geom::Derived<T>inderived.hcallscompute()unqualified. Two new integration assertions confirm zero leaked edges in this variant, verifying the suppression stack independently of the class-owned filter.