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