@@ -508,7 +508,7 @@ UNINTERESTING_FEATURE(SuppressedAssociatedTypes)
508
508
509
509
static bool disallowFeatureSuppression(StringRef featureName, Decl *decl);
510
510
511
- static bool allBoundTypesAreCopyable (Type type, DeclContext *context) {
511
+ static bool allSubstTypesAreCopyable (Type type, DeclContext *context) {
512
512
assert (type->getAnyNominal ());
513
513
auto bgt = type->getAs <BoundGenericType>();
514
514
if (!bgt)
@@ -549,11 +549,14 @@ static bool usesFeatureNoncopyableGenerics(Decl *decl) {
549
549
return false ;
550
550
551
551
// 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)
555
558
if (!disallowFeatureSuppression (" NoncopyableGenerics" , nominalDecl)
556
- && allBoundTypesAreCopyable (type, context)) {
559
+ && allSubstTypesAreCopyable (type, context)) {
557
560
return false ;
558
561
}
559
562
0 commit comments