Requalify incorrect references produced by doxygen (#56058)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56058

Changelog: [Internal]

Doxygen may incorrectly resolve reference to a friend declaration or inherited constructor instead of the actual friend or the base class.

This diff updates the qualification algorithm to try to requalify cases like these.

Reviewed By: cipolleschi

Differential Revision: D96129278

fbshipit-source-id: fba4c78c74d43870a2a14f5eedce061ba6f2793d
This commit is contained in:
Jakub Piasecki authored and meta-codesync[bot] committed 2026-03-11 23:51:12 -07:00
1 parent d177839a24
commit 4e1a8777ba
5 files changed
+76 -9

No files matched your search

+11 -9
View File
@@ -409,16 +409,18 @@ class Scope(Generic[ScopeKindT]):
if anchor_prefix:
return f"{anchor_prefix}::{suffix}"
return suffix
elif any(
isinstance(m, FriendMember) and m.name == base_name
for m in current_scope._members
):
# The name matches a friend declaration, not a real member.
# Re-qualify from the remaining segments so the type resolves
# to its actual definition rather than the friend's owning class.
remaining = "::".join(path[i:])
return self.qualify_name(remaining)
else:
# Segment not found as an inner scope or a real member of
# the current scope. When inside a struct-like scope this
# typically means Doxygen's refid-based qualification
# incorrectly placed a type under a compound that does not
# actually contain it — for example a friend declaration or
# an inherited constructor reported as a member ref. Try
# to re-qualify from the remaining unmatched segments so the
# type resolves against the broader scope hierarchy.
if isinstance(current_scope.kind, StructLikeScopeKind):
remaining = "::".join(path[i:])
return self.qualify_name(remaining)
return None
# Return qualified name with preserved template arguments