mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-08-03 09:53:01 -05:00
C++, ensure merging case is as assumed
This commit is contained in:
@@ -4850,7 +4850,7 @@ class Symbol:
|
||||
if symbol.declaration is None:
|
||||
if Symbol.debug_lookup:
|
||||
Symbol.debug_print("empty candidate")
|
||||
# if in the end we have non matching, but have an empty one,
|
||||
# if in the end we have non-matching, but have an empty one,
|
||||
# then just continue with that
|
||||
ourChild = symbol
|
||||
continue
|
||||
@@ -4880,10 +4880,10 @@ class Symbol:
|
||||
if (otherChild.declaration.objectType ==
|
||||
ourChild.declaration.objectType and
|
||||
otherChild.declaration.objectType in
|
||||
('templateParam', 'functionParam')):
|
||||
# `ourChild` was presumably just created during mergging
|
||||
# by the call to `_fill_empty` on the parent and can be
|
||||
# ignored.
|
||||
('templateParam', 'functionParam') and
|
||||
ourChild.parent.declaration == otherChild.parent.declaration):
|
||||
# `ourChild` was just created during merging by the call
|
||||
# to `_fill_empty` on the parent and can be ignored.
|
||||
pass
|
||||
else:
|
||||
# Both have declarations, and in the same docname.
|
||||
@@ -5153,6 +5153,7 @@ class Symbol:
|
||||
res.append(": ")
|
||||
if self.isRedeclaration:
|
||||
res.append('!!duplicate!! ')
|
||||
res.append("{" + self.declaration.objectType + "} ")
|
||||
res.append(str(self.declaration))
|
||||
if self.docname:
|
||||
res.append('\t(')
|
||||
|
||||
@@ -1414,8 +1414,8 @@ def test_domain_cpp_normalize_unspecialized_template_args(make_app, app_params):
|
||||
assert root1.dump(1) == (
|
||||
' ::\n'
|
||||
' template<typename T> \n'
|
||||
' A: template<typename T> A\t(text1)\n'
|
||||
' T: typename T\t(text1)\n'
|
||||
' A: {class} template<typename T> A\t(text1)\n'
|
||||
' T: {templateParam} typename T\t(text1)\n'
|
||||
)
|
||||
|
||||
app2 = make_app(*args, **kwargs)
|
||||
@@ -1428,8 +1428,8 @@ def test_domain_cpp_normalize_unspecialized_template_args(make_app, app_params):
|
||||
' A\n'
|
||||
' T\n'
|
||||
' template<typename U> \n'
|
||||
' B: template<typename T> template<typename U> A<T>::B\t(text2)\n'
|
||||
' U: typename U\t(text2)\n'
|
||||
' B: {class} template<typename T> template<typename U> A<T>::B\t(text2)\n'
|
||||
' U: {templateParam} typename U\t(text2)\n'
|
||||
)
|
||||
|
||||
root2.merge_with(root1, ['text1'], app2.env)
|
||||
@@ -1437,11 +1437,11 @@ def test_domain_cpp_normalize_unspecialized_template_args(make_app, app_params):
|
||||
assert root2.dump(1) == (
|
||||
' ::\n'
|
||||
' template<typename T> \n'
|
||||
' A: template<typename T> A\t(text1)\n'
|
||||
' T: typename T\t(text1)\n'
|
||||
' A: {class} template<typename T> A\t(text1)\n'
|
||||
' T: {templateParam} typename T\t(text1)\n'
|
||||
' template<typename U> \n'
|
||||
' B: template<typename T> template<typename U> A<T>::B\t(text2)\n'
|
||||
' U: typename U\t(text2)\n'
|
||||
' B: {class} template<typename T> template<typename U> A<T>::B\t(text2)\n'
|
||||
' U: {templateParam} typename U\t(text2)\n'
|
||||
)
|
||||
warning = app2._warning.getvalue()
|
||||
assert 'Internal C++ domain error during symbol merging' not in warning
|
||||
|
||||
Reference in New Issue
Block a user