@@ -508,7 +508,7 @@ UNINTERESTING_FEATURE(SuppressedAssociatedTypes)
508508
509509static bool disallowFeatureSuppression(StringRef featureName, Decl *decl);
510510
511- static bool allBoundTypesAreCopyable (Type type, DeclContext *context) {
511+ static bool allSubstTypesAreCopyable (Type type, DeclContext *context) {
512512 assert (type->getAnyNominal ());
513513 auto bgt = type->getAs <BoundGenericType>();
514514 if (!bgt)
@@ -549,11 +549,14 @@ static bool usesFeatureNoncopyableGenerics(Decl *decl) {
549549 return false ;
550550
551551 // If we only _refer_ to a TypeDecl that uses NoncopyableGenerics,
552- // and a suppressed version of that decl is in the interface, then we're
553- // only referring to the un-suppressed version if any of the bound types
554- // are noncopyable. (rdar://127389991)
552+ // and a suppressed version of that decl is in the interface, and
553+ // if we only substitute Copyable types for the generic parameters,
554+ // then we can say this decl is not "using" the feature such that
555+ // a feature guard is required. In other words, this reference to the
556+ // type will always be valid, regardless of whether the feature is
557+ // enabled or not. (rdar://127389991)
555558 if (!disallowFeatureSuppression (" NoncopyableGenerics" , nominalDecl)
556- && allBoundTypesAreCopyable (type, context)) {
559+ && allSubstTypesAreCopyable (type, context)) {
557560 return false ;
558561 }
559562
0 commit comments