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