@@ -3119,36 +3119,22 @@ namespace {
3119
3119
mayExecuteConcurrentlyWith (
3120
3120
localFunc.getAsDeclContext (), getDeclContext (),
3121
3121
/* 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
-
3130
3122
for (const auto &capturedType :
3131
3123
localFunc.getCaptureInfo ().getCapturedTypes ()) {
3132
- unsigned genericDepth;
3133
3124
Type type = capturedType.getType ();
3134
3125
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 ;
3139
3134
} else {
3140
3135
continue ;
3141
3136
}
3142
3137
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
-
3152
3138
// Check that the metatype is sendable.
3153
3139
SendableCheckContext sendableContext (getDeclContext (), preconcurrency);
3154
3140
diagnoseNonSendableTypes (MetatypeType::get (type),
0 commit comments