@@ -3103,36 +3103,22 @@ namespace {
3103
3103
mayExecuteConcurrentlyWith (
3104
3104
localFunc.getAsDeclContext (), getDeclContext (),
3105
3105
/* 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
-
3114
3106
for (const auto &capturedType :
3115
3107
localFunc.getCaptureInfo ().getCapturedTypes ()) {
3116
- unsigned genericDepth;
3117
3108
Type type = capturedType.getType ();
3118
3109
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 ;
3123
3118
} else {
3124
3119
continue ;
3125
3120
}
3126
3121
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
-
3136
3122
// Check that the metatype is sendable.
3137
3123
SendableCheckContext sendableContext (getDeclContext (), preconcurrency);
3138
3124
diagnoseNonSendableTypes (MetatypeType::get (type),
0 commit comments