File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,10 @@ def matches(self, other: "ASTIdentifier") -> bool:
135135 return False
136136 if self .tag is None :
137137 return True
138- return self .tag == other .tag
138+ assert other .tag is not None
139+ isTag = self .tag == ''
140+ isOtherTag = other .tag == ''
141+ return isTag == isOtherTag
139142
140143 # and this is where we finally make a difference between __str__ and the display string
141144
Original file line number Diff line number Diff line change @@ -673,6 +673,21 @@ def test_ids_vs_tags2(app, warning):
673673 assert len (ws ) == 0
674674
675675
676+ def test_duplicate_tags (app , warning ):
677+ text = """
678+ .. c:struct:: A
679+ .. c:union:: A
680+ .. c:enum:: A
681+ """
682+ restructuredtext .parse (app , text )
683+ ws = split_warnigns (warning )
684+ assert len (ws ) == 4
685+ assert "index.rst:3: WARNING: Duplicate C declaration" in ws [0 ]
686+ assert "Declaration is '.. c:union:: A'." in ws [1 ]
687+ assert "index.rst:4: WARNING: Duplicate C declaration" in ws [2 ]
688+ assert "Declaration is '.. c:enum:: A'." in ws [3 ]
689+
690+
676691def test_build_domain_c_semicolon (app , warning ):
677692 text = """
678693.. c:member:: int member;
You can’t perform that action at this time.
0 commit comments