C, C++, do not recurse in anon symbols on addition

This commit is contained in:
Jakob Lykke Andersen 2020-03-25 20:07:16 +01:00
parent 6be31aa05c
commit 67e5edde6d
6 changed files with 29 additions and 2 deletions

View File

@ -1675,7 +1675,7 @@ class Symbol:
onMissingQualifiedSymbol, onMissingQualifiedSymbol,
ancestorLookupType=None, ancestorLookupType=None,
matchSelf=False, matchSelf=False,
recurseInAnon=True, recurseInAnon=False,
searchInSiblings=False) searchInSiblings=False)
assert lookupResult is not None # we create symbols all the way, so that can't happen assert lookupResult is not None # we create symbols all the way, so that can't happen
symbols = list(lookupResult.symbols) symbols = list(lookupResult.symbols)

View File

@ -4159,7 +4159,7 @@ class Symbol:
ancestorLookupType=None, ancestorLookupType=None,
templateShorthand=False, templateShorthand=False,
matchSelf=False, matchSelf=False,
recurseInAnon=True, recurseInAnon=False,
correctPrimaryTemplateArgs=True, correctPrimaryTemplateArgs=True,
searchInSiblings=False) searchInSiblings=False)
assert lookupResult is not None # we create symbols all the way, so that can't happen assert lookupResult is not None # we create symbols all the way, so that can't happen

View File

@ -0,0 +1,5 @@
.. c:struct:: anon_dup_decl
.. c:struct:: @a.A
.. c:struct:: @b.A
.. c:struct:: A

View File

@ -0,0 +1,4 @@
.. cpp:namespace:: anon_dup_decl
.. cpp:class:: @a::A
.. cpp:class:: @b::A
.. cpp:class:: A

View File

@ -474,6 +474,15 @@ def test_build_domain_c(app, status, warning):
assert len(ws) == 0 assert len(ws) == 0
@pytest.mark.sphinx(testroot='domain-c', confoverrides={'nitpicky': True})
def test_build_domain_c_anon_dup_decl(app, status, warning):
app.builder.build_all()
ws = filter_warnings(warning, "anon-dup-decl")
assert len(ws) == 2
assert "WARNING: c:identifier reference target not found: @a" in ws[0]
assert "WARNING: c:identifier reference target not found: @b" in ws[1]
def test_cfunction(app): def test_cfunction(app):
text = (".. c:function:: PyObject* " text = (".. c:function:: PyObject* "
"PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)") "PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)")

View File

@ -913,6 +913,15 @@ def test_build_domain_cpp_backslash_ok(app, status, warning):
assert "WARNING: Parsing of expression failed. Using fallback parser." in ws[0] assert "WARNING: Parsing of expression failed. Using fallback parser." in ws[0]
@pytest.mark.sphinx(testroot='domain-cpp', confoverrides={'nitpicky': True})
def test_build_domain_cpp_anon_dup_decl(app, status, warning):
app.builder.build_all()
ws = filter_warnings(warning, "anon-dup-decl")
assert len(ws) == 2
assert "WARNING: cpp:identifier reference target not found: @a" in ws[0]
assert "WARNING: cpp:identifier reference target not found: @b" in ws[1]
@pytest.mark.sphinx(testroot='domain-cpp') @pytest.mark.sphinx(testroot='domain-cpp')
def test_build_domain_cpp_misuse_of_roles(app, status, warning): def test_build_domain_cpp_misuse_of_roles(app, status, warning):
app.builder.build_all() app.builder.build_all()