@@ -358,7 +358,8 @@ class InheritedProtocolCollector {
358
358
// / For each type in \p directlyInherited, classify the protocols it refers to
359
359
// / as included for printing or not, and record them in the appropriate
360
360
// / vectors.
361
- void recordProtocols (ArrayRef<TypeLoc> directlyInherited, const Decl *D) {
361
+ void recordProtocols (ArrayRef<TypeLoc> directlyInherited, const Decl *D,
362
+ bool skipSynthesized = false ) {
362
363
Optional<AvailableAttrList> availableAttrs;
363
364
364
365
for (TypeLoc inherited : directlyInherited) {
@@ -379,6 +380,9 @@ class InheritedProtocolCollector {
379
380
// any of those besides 'AnyObject'.
380
381
}
381
382
383
+ if (skipSynthesized)
384
+ return ;
385
+
382
386
// Check for synthesized protocols, like Hashable on enums.
383
387
if (auto *nominal = dyn_cast<NominalTypeDecl>(D)) {
384
388
SmallVector<ProtocolConformance *, 4 > localConformances =
@@ -456,7 +460,8 @@ class InheritedProtocolCollector {
456
460
if (auto *CD = dyn_cast<ClassDecl>(D)) {
457
461
for (auto *SD = CD->getSuperclassDecl (); SD;
458
462
SD = SD->getSuperclassDecl ()) {
459
- map[nominal].recordProtocols (SD->getInherited (), SD);
463
+ map[nominal].recordProtocols (
464
+ SD->getInherited (), SD, /* skipSynthesized=*/ true );
460
465
for (auto *Ext: SD->getExtensions ()) {
461
466
if (shouldInclude (Ext)) {
462
467
map[nominal].recordProtocols (Ext->getInherited (), Ext);
0 commit comments