@@ -1613,19 +1613,17 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
16131613 // ExtendedExistentialTypeShapes consider existential metatypes to
16141614 // be part of the existential, so if we're symbolically referencing
16151615 // shapes, we need to handle that at this level.
1616- if (EMT->getExistentialLayout ().needsExtendedShape ()) {
1616+ if (EMT->getExistentialLayout ().needsExtendedShape (AllowInverses )) {
16171617 auto referent = SymbolicReferent::forExtendedExistentialTypeShape (EMT);
16181618 if (canSymbolicReference (referent)) {
16191619 appendSymbolicExtendedExistentialType (referent, EMT, sig, forDecl);
16201620 return ;
16211621 }
1622- }
16231622
1624- if (EMT->getInstanceType ()->isExistentialType () &&
1625- EMT->hasParameterizedExistential ())
16261623 appendConstrainedExistential (EMT->getInstanceType (), sig, forDecl);
1627- else
1624+ } else {
16281625 appendType (EMT->getInstanceType (), sig, forDecl);
1626+ }
16291627
16301628 if (EMT->hasRepresentation ()) {
16311629 appendOperator (" Xm" ,
@@ -1678,8 +1676,7 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
16781676 return appendType (strippedTy, sig, forDecl);
16791677 }
16801678
1681- if (PCT->hasParameterizedExistential ()
1682- || (PCT->hasInverse () && AllowInverses))
1679+ if (PCT->getExistentialLayout ().needsExtendedShape (AllowInverses))
16831680 return appendConstrainedExistential (PCT, sig, forDecl);
16841681
16851682 // We mangle ProtocolType and ProtocolCompositionType using the
@@ -1693,7 +1690,8 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
16931690
16941691 case TypeKind::Existential: {
16951692 auto *ET = cast<ExistentialType>(tybase);
1696- if (ET->getExistentialLayout ().needsExtendedShape ()) {
1693+
1694+ if (ET->getExistentialLayout ().needsExtendedShape (AllowInverses)) {
16971695 auto referent = SymbolicReferent::forExtendedExistentialTypeShape (ET);
16981696 if (canSymbolicReference (referent)) {
16991697 appendSymbolicExtendedExistentialType (referent, ET, sig, forDecl);
@@ -1703,6 +1701,7 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
17031701 return appendConstrainedExistential (ET->getConstraintType (), sig,
17041702 forDecl);
17051703 }
1704+
17061705 return appendType (ET->getConstraintType (), sig, forDecl);
17071706 }
17081707
0 commit comments