@@ -4192,18 +4192,26 @@ void ASTMangler::appendAnyProtocolConformance(
4192
4192
conformance.getRequirement ()->isMarkerProtocol ())
4193
4193
return ;
4194
4194
4195
- // While all invertible protocols are marker protocols, do not mangle them for
4196
- // compatability reasons. See equivalent hack in `conformanceRequirementIndex`
4197
- // where only invertible protocols are unconditionally skipped.
4198
- if (conformance.getRequirement ()->getInvertibleProtocolKind ())
4199
- return ;
4195
+ // While all invertible protocols are marker protocols, do not mangle them
4196
+ // as a dependent conformance. See `conformanceRequirementIndex` which skips
4197
+ // these, too. In theory, invertible conformances should never be mangled,
4198
+ // but we *might* have let that slip by for the other cases below, so the
4199
+ // early-exits are highly conservative.
4200
+ const bool forInvertible =
4201
+ conformance.getRequirement ()->getInvertibleProtocolKind ().has_value ();
4200
4202
4201
4203
if (conformingType->isTypeParameter ()) {
4202
4204
assert (genericSig && " Need a generic signature to resolve conformance" );
4205
+ if (forInvertible)
4206
+ return ;
4207
+
4203
4208
auto path = genericSig->getConformancePath (conformingType,
4204
4209
conformance.getAbstract ());
4205
4210
appendDependentProtocolConformance (path, genericSig);
4206
4211
} else if (auto opaqueType = conformingType->getAs <OpaqueTypeArchetypeType>()) {
4212
+ if (forInvertible)
4213
+ return ;
4214
+
4207
4215
GenericSignature opaqueSignature =
4208
4216
opaqueType->getDecl ()->getOpaqueInterfaceGenericSignature ();
4209
4217
ConformancePath conformancePath =
0 commit comments