@@ -3119,36 +3119,22 @@ namespace {
31193119 mayExecuteConcurrentlyWith (
31203120 localFunc.getAsDeclContext (), getDeclContext (),
31213121 /* includeSending*/ true )) {
3122- auto innermostGenericDC = localFunc.getAsDeclContext ();
3123- while (innermostGenericDC && !innermostGenericDC->isGenericContext ())
3124- innermostGenericDC = innermostGenericDC->getParent ();
3125-
3126- GenericSignature genericSig = innermostGenericDC
3127- ? innermostGenericDC->getGenericSignatureOfContext ()
3128- : GenericSignature ();
3129-
31303122 for (const auto &capturedType :
31313123 localFunc.getCaptureInfo ().getCapturedTypes ()) {
3132- unsigned genericDepth;
31333124 Type type = capturedType.getType ();
31343125 if (auto archetype = type->getAs <ArchetypeType>()) {
3135- genericDepth = archetype->getInterfaceType ()->getRootGenericParam ()
3136- ->getDepth ();
3137- } else if (type->isTypeParameter ()) {
3138- genericDepth = type->getRootGenericParam ()->getDepth ();
3126+ // If the generic signature of the environment prohibits this
3127+ // type to have an isolated conformance, there is nothing to
3128+ // diagnose.
3129+ Type interfaceType = archetype->getInterfaceType ();
3130+ auto genericEnv = archetype->getGenericEnvironment ();
3131+ auto genericSig = genericEnv->getGenericSignature ();
3132+ if (genericSig->prohibitsIsolatedConformance (interfaceType))
3133+ continue ;
31393134 } else {
31403135 continue ;
31413136 }
31423137
3143- // If the local function is generic and this is one of its generic
3144- // parameters, ignore it.
3145- if (genericSig.getNextDepth () > 0 &&
3146- genericDepth >= genericSig.getNextDepth ())
3147- continue ;
3148-
3149- if (type->isTypeParameter () && innermostGenericDC)
3150- type = innermostGenericDC->mapTypeIntoContext (type);
3151-
31523138 // Check that the metatype is sendable.
31533139 SendableCheckContext sendableContext (getDeclContext (), preconcurrency);
31543140 diagnoseNonSendableTypes (MetatypeType::get (type),
0 commit comments