C++, ensure merging case is as assumed

This commit is contained in:
Jakob Lykke Andersen
2022-07-29 18:14:45 +02:00
parent 5b97ec522a
commit 66f98957b1
2 changed files with 14 additions and 13 deletions
+6 -5
View File
@@ -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(')
+8 -8
View File
@@ -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