Commit fda3cfb
Fix Doxygen merging base classes from primary templates into specializations (#56239)
Summary:
Pull Request resolved: #56239
Doxygen incorrectly merges base classes from primary templates into their partial specializations. In C++, a specialization's inheritance list completely replaces the primary template's, but Doxygen combines both into a single basecompoundref list.
- **Contradictory type traits** — is_optional<std::optional<T>> and is_variant_of_data_types<std::variant<Ts...>> showed inheritance from both std::false_type (primary) and std::true_type (specialization)
- **Duplicate base classes** — Converter<jsi::Object> listed ConverterBase<jsi::Object> twice (once from the primary template after substitution, once from the specialization)
This diff fixes both issues with two complementary mechanisms:
- **Dedup-by-name (Extendable._deduplicate_base_classes)**: removes exact duplicate base classes, keeping the last occurrence. Handles cases where Doxygen's template argument substitution produces identical names.
- **Primary template base subtraction (StructLikeScopeKind._remove_merged_primary_bases)**: for partial specializations, looks up the primary template among sibling scopes and performs count-based subtraction of its bases. Count-based (rather than set-based) subtraction correctly preserves bases that a specialization explicitly re-inherits from the same class as the primary.
Changelog:
[Internal]
Reviewed By: cipolleschi
Differential Revision: D982913601 parent 8fa7cb8 commit fda3cfb
File tree
10 files changed
+123
-18
lines changed- scripts/cxx-api
- api-snapshots
- parser/scope
- tests/snapshots/should_deduplicate_base_classes
10 files changed
+123
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10875 | 10875 | | |
10876 | 10876 | | |
10877 | 10877 | | |
10878 | | - | |
| 10878 | + | |
10879 | 10879 | | |
10880 | 10880 | | |
10881 | 10881 | | |
| |||
12472 | 12472 | | |
12473 | 12473 | | |
12474 | 12474 | | |
12475 | | - | |
| 12475 | + | |
12476 | 12476 | | |
12477 | 12477 | | |
12478 | 12478 | | |
12479 | 12479 | | |
12480 | 12480 | | |
12481 | | - | |
| 12481 | + | |
12482 | 12482 | | |
12483 | 12483 | | |
12484 | 12484 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10702 | 10702 | | |
10703 | 10703 | | |
10704 | 10704 | | |
10705 | | - | |
| 10705 | + | |
10706 | 10706 | | |
10707 | 10707 | | |
10708 | 10708 | | |
| |||
12299 | 12299 | | |
12300 | 12300 | | |
12301 | 12301 | | |
12302 | | - | |
| 12302 | + | |
12303 | 12303 | | |
12304 | 12304 | | |
12305 | 12305 | | |
12306 | 12306 | | |
12307 | 12307 | | |
12308 | | - | |
| 12308 | + | |
12309 | 12309 | | |
12310 | 12310 | | |
12311 | 12311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13328 | 13328 | | |
13329 | 13329 | | |
13330 | 13330 | | |
13331 | | - | |
| 13331 | + | |
13332 | 13332 | | |
13333 | 13333 | | |
13334 | 13334 | | |
| |||
14860 | 14860 | | |
14861 | 14861 | | |
14862 | 14862 | | |
14863 | | - | |
| 14863 | + | |
14864 | 14864 | | |
14865 | 14865 | | |
14866 | 14866 | | |
14867 | 14867 | | |
14868 | 14868 | | |
14869 | | - | |
| 14869 | + | |
14870 | 14870 | | |
14871 | 14871 | | |
14872 | 14872 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13155 | 13155 | | |
13156 | 13156 | | |
13157 | 13157 | | |
13158 | | - | |
| 13158 | + | |
13159 | 13159 | | |
13160 | 13160 | | |
13161 | 13161 | | |
| |||
14687 | 14687 | | |
14688 | 14688 | | |
14689 | 14689 | | |
14690 | | - | |
| 14690 | + | |
14691 | 14691 | | |
14692 | 14692 | | |
14693 | 14693 | | |
14694 | 14694 | | |
14695 | 14695 | | |
14696 | | - | |
| 14696 | + | |
14697 | 14697 | | |
14698 | 14698 | | |
14699 | 14699 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7628 | 7628 | | |
7629 | 7629 | | |
7630 | 7630 | | |
7631 | | - | |
| 7631 | + | |
7632 | 7632 | | |
7633 | 7633 | | |
7634 | 7634 | | |
| |||
9153 | 9153 | | |
9154 | 9154 | | |
9155 | 9155 | | |
9156 | | - | |
| 9156 | + | |
9157 | 9157 | | |
9158 | 9158 | | |
9159 | 9159 | | |
9160 | 9160 | | |
9161 | 9161 | | |
9162 | | - | |
| 9162 | + | |
9163 | 9163 | | |
9164 | 9164 | | |
9165 | 9165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7619 | 7619 | | |
7620 | 7620 | | |
7621 | 7621 | | |
7622 | | - | |
| 7622 | + | |
7623 | 7623 | | |
7624 | 7624 | | |
7625 | 7625 | | |
| |||
9144 | 9144 | | |
9145 | 9145 | | |
9146 | 9146 | | |
9147 | | - | |
| 9147 | + | |
9148 | 9148 | | |
9149 | 9149 | | |
9150 | 9150 | | |
9151 | 9151 | | |
9152 | 9152 | | |
9153 | | - | |
| 9153 | + | |
9154 | 9154 | | |
9155 | 9155 | | |
9156 | 9156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
28 | 42 | | |
29 | 43 | | |
30 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
47 | 87 | | |
48 | 88 | | |
49 | 89 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments