fix(cpp): resolve cross-namespace same-tail inheritance bases bridge-held (#1993)#2002
Closed
magyargergo wants to merge 2 commits into
Closed
Conversation
…held (abhigyanpatwari#1993) PR abhigyanpatwari#1981's bridge fixed within-namespace same-tail heritage (NS::A::Inner vs NS::B::Inner). The residual: a cross-namespace same-tail base (NS1::A::Inner vs NS2::A::Inner) both key the namespace-omitted `A.Inner` in the qualifiedNames index, so resolveQualifiedInheritanceBase couldn't pick a winner and the deriving classes cross-wired (DB's EXTENDS bound to NS1's A::Inner). Fixed bridge-held via the existing `namespacePrefix` sidecar — no qualifiedName invariant flip, no resolution-index re-keying: (1) tagNamespacePrefixes also tags defs declared directly in a namespace (the deriving NS1::DA), composed identically to the class-nested path; (2) resolveQualifiedInheritanceBase breaks a same-tail tie by preferring the candidate whose namespacePrefix matches the deriving class's. Two-phase lookup, UDC, brace-init, file-local linkage untouched (def.qualifiedName + index keys unchanged). New cpp-cross-namespace-same-tail fixture + registry-primary test (in the cpp parity expected-failures). Verified: cpp suite 287/287 primary, 209 + 78 skips legacy — no regression; tsc + prettier clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@magyargergo is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
Collaborator
Author
|
Superseded by same-repo stacked PR #2005. |
Contributor
CI Report❌ Some checks failed Pipeline Status
Test Results
✅ All 11041 tests passed 16 test(s) skipped — expand for details
Code CoverageTests
📋 View full run · Generated by CI |
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.
Summary
Follow-up to #1981 / #1982. PR #1981 landed a targeted bridge (
tagNamespacePrefixes+ aresolveDefGraphIdnamespace-prefixed retry) that fixes the within-namespace same-tail heritage case (NS::A::InnervsNS::B::Inner, distinguished by the class chain). The residual: a cross-namespace same-tail base (NS1::A::InnervsNS2::A::Inner) — both key the namespace-omittedA.Innerin thequalifiedNamesresolution index, soresolveQualifiedInheritanceBasecould not pick a winner and the deriving classes cross-wired (DB's EXTENDS bound to NS1'sA::Inner).Fixed bridge-held — without flipping the class-chain-only
qualifiedNameinvariant (which would re-bite two-phase lookup / UDC / brace-init) and without re-keying the resolution index.Fix
The
namespacePrefixsidecar (set bytagNamespacePrefixes, deliberately separate fromqualifiedName) already records each namespaced def's enclosing namespace. Two sidecar-only changes:tagNamespacePrefixesnow also tags defs declared directly in a namespace (e.g. the derivingNS1::DA), composed identically to the existing class-nested path. The original loop only reached class-nested defs (A::Inner).resolveQualifiedInheritanceBase, on a same-tail tie at a key, breaks the tie by preferring the candidate whosenamespacePrefixmatches the deriving class's — the base in the same enclosing namespace. It still refuses when the sidecar can't pick a unique.def.qualifiedNameand thequalifiedNamesindex keys are untouched, so two-phase lookup, UDC ranking, brace-init, and file-local linkage are unaffected. The deferred root-cause work (makingqualifiedNamenamespace-inclusive and removing the bridge) is unchanged and out of scope.Tests
New
cpp-cross-namespace-same-tailfixture + test (registry-primary, in the cpp parity expected-failures like the #1982 namespaced tests):NS1.DAEXTENDSNS1.A.InnerandNS2.DBEXTENDSNS2.A.Inner— positive base-identity by the resolved node'squalifiedName, which fails pre-fix (DBcross-wired toNS1.A.Inner).Verification
cppresolver suite: registry-primary 287/287, legacy green — no regression to brace-init, UDC, two-phase lookup, ADL, file-local linkage, or the within-namespace (Qualified nested-type node identity — resolution-side follow-up (Ruby same-tail routed-props/mixins + Rust inherent impls) #1982) namespaced-collision tests.tsc --noEmitclean; prettier clean.Closes #1993.
🤖 Generated with Claude Code