@@ -3103,36 +3103,22 @@ namespace {
31033103 mayExecuteConcurrentlyWith (
31043104 localFunc.getAsDeclContext (), getDeclContext (),
31053105 /* includeSending*/ true )) {
3106- auto innermostGenericDC = localFunc.getAsDeclContext ();
3107- while (innermostGenericDC && !innermostGenericDC->isGenericContext ())
3108- innermostGenericDC = innermostGenericDC->getParent ();
3109-
3110- GenericSignature genericSig = innermostGenericDC
3111- ? innermostGenericDC->getGenericSignatureOfContext ()
3112- : GenericSignature ();
3113-
31143106 for (const auto &capturedType :
31153107 localFunc.getCaptureInfo ().getCapturedTypes ()) {
3116- unsigned genericDepth;
31173108 Type type = capturedType.getType ();
31183109 if (auto archetype = type->getAs <ArchetypeType>()) {
3119- genericDepth = archetype->getInterfaceType ()->getRootGenericParam ()
3120- ->getDepth ();
3121- } else if (type->isTypeParameter ()) {
3122- genericDepth = type->getRootGenericParam ()->getDepth ();
3110+ // If the generic signature of the environment prohibits this
3111+ // type to have an isolated conformance, there is nothing to
3112+ // diagnose.
3113+ Type interfaceType = archetype->getInterfaceType ();
3114+ auto genericEnv = archetype->getGenericEnvironment ();
3115+ auto genericSig = genericEnv->getGenericSignature ();
3116+ if (genericSig->prohibitsIsolatedConformance (interfaceType))
3117+ continue ;
31233118 } else {
31243119 continue ;
31253120 }
31263121
3127- // If the local function is generic and this is one of its generic
3128- // parameters, ignore it.
3129- if (genericSig.getNextDepth () > 0 &&
3130- genericDepth >= genericSig.getNextDepth ())
3131- continue ;
3132-
3133- if (type->isTypeParameter () && innermostGenericDC)
3134- type = innermostGenericDC->mapTypeIntoContext (type);
3135-
31363122 // Check that the metatype is sendable.
31373123 SendableCheckContext sendableContext (getDeclContext (), preconcurrency);
31383124 diagnoseNonSendableTypes (MetatypeType::get (type),
0 commit comments