@@ -260,6 +260,14 @@ void ConformanceLookupTable::inheritConformances(ClassDecl *classDecl,
260
260
auto addInheritedConformance = [&](ConformanceEntry *entry) {
261
261
auto protocol = entry->getProtocol ();
262
262
263
+ // Don't add unavailable conformances.
264
+ if (auto dc = entry->Source .getDeclContext ()) {
265
+ if (auto ext = dyn_cast<ExtensionDecl>(dc)) {
266
+ if (AvailableAttr::isUnavailable (ext))
267
+ return ;
268
+ }
269
+ }
270
+
263
271
// Don't add redundant conformances here. This is merely an
264
272
// optimization; resolveConformances() would zap the duplicates
265
273
// anyway.
@@ -621,14 +629,6 @@ ConformanceLookupTable::Ordering ConformanceLookupTable::compareConformances(
621
629
622
630
// Allow replacement of an explicit conformance to a marker protocol.
623
631
// (This permits redundant explicit declarations of `Sendable`.)
624
- //
625
- // FIXME: We need to warn on attempts to make an unavailable Sendable
626
- // conformance available, which does not work.
627
- //
628
- // We probably also want to warn if there is an existing, explicit
629
- // conformance, so clients are prompted to remove retroactive unchecked
630
- // Sendable conformances when the proper Sendable conformance is added
631
- // in the original module.
632
632
return (kind == ConformanceEntryKind::Explicit
633
633
&& entry->getProtocol ()->isMarkerProtocol ());
634
634
};
@@ -880,6 +880,8 @@ DeclContext *ConformanceLookupTable::getConformingContext(
880
880
return nullptr ;
881
881
auto inheritedConformance = swift::lookupConformance (
882
882
superclassTy, protocol, /* allowMissing=*/ false );
883
+ if (inheritedConformance.hasUnavailableConformance ())
884
+ inheritedConformance = ProtocolConformanceRef::forInvalid ();
883
885
if (inheritedConformance)
884
886
return superclassDecl;
885
887
} while ((superclassDecl = superclassDecl->getSuperclassDecl ()));
0 commit comments