@@ -1016,9 +1016,13 @@ ModuleDecl::lookupExistentialConformance(Type type, ProtocolDecl *protocol) {
10161016 // concretely.
10171017 if (auto superclass = layout.explicitSuperclass ) {
10181018 if (auto result = lookupConformance (
1019- superclass, protocol, /* allowMissing=*/ false ,
1020- /* allowUnavailable=*/ false ))
1019+ superclass, protocol, /* allowMissing=*/ false )) {
1020+ if (protocol->isSpecificProtocol (KnownProtocolKind::Sendable) &&
1021+ result.hasUnavailableConformance ())
1022+ result = ProtocolConformanceRef::forInvalid ();
1023+
10211024 return result;
1025+ }
10221026 }
10231027
10241028 // Otherwise, the existential might conform abstractly.
@@ -1073,8 +1077,7 @@ ProtocolConformanceRef ProtocolConformanceRef::forMissingOrInvalid(
10731077
10741078ProtocolConformanceRef ModuleDecl::lookupConformance (Type type,
10751079 ProtocolDecl *protocol,
1076- bool allowMissing,
1077- bool allowUnavailable) {
1080+ bool allowMissing) {
10781081 // If we are recursively checking for implicit conformance of a nominal
10791082 // type to Sendable, fail without evaluating this request. This
10801083 // squashes cycles.
@@ -1098,11 +1101,6 @@ ProtocolConformanceRef ModuleDecl::lookupConformance(Type type,
10981101 result.hasMissingConformance (this ))
10991102 return ProtocolConformanceRef::forInvalid ();
11001103
1101- // If we aren't supposed to allow unavailable conformances but we have one,
1102- // replace the result with an "invalid" result.
1103- if (!allowUnavailable && result.hasUnavailableConformance ())
1104- return ProtocolConformanceRef::forInvalid ();
1105-
11061104 return result;
11071105}
11081106
@@ -1256,9 +1254,12 @@ LookupConformanceInModuleRequest::evaluate(
12561254 // able to be resolved by a substitution that makes the archetype
12571255 // concrete.
12581256 if (auto super = archetype->getSuperclass ()) {
1259- if (auto inheritedConformance = mod->lookupConformance (
1260- super, protocol, /* allowMissing=*/ false ,
1261- /* allowUnavailable=*/ false )) {
1257+ auto inheritedConformance = mod->lookupConformance (
1258+ super, protocol, /* allowMissing=*/ false );
1259+ if (protocol->isSpecificProtocol (KnownProtocolKind::Sendable) &&
1260+ inheritedConformance.hasUnavailableConformance ())
1261+ inheritedConformance = ProtocolConformanceRef::forInvalid ();
1262+ if (inheritedConformance) {
12621263 return ProtocolConformanceRef (ctx.getInheritedConformance (
12631264 type, inheritedConformance.getConcrete ()));
12641265 }
0 commit comments