@@ -3752,10 +3752,12 @@ void ASTMangler::appendAssociatedTypeName(DependentMemberType *dmt,
37523752
37533753void ASTMangler::appendClosureEntity (
37543754 const SerializedAbstractClosureExpr *closure) {
3755- assert (!closure->getType ()->hasLocalArchetype () &&
3755+ auto canType = closure->getType ()->getCanonicalType ();
3756+ assert (!canType->hasLocalArchetype () &&
37563757 " Not enough information here to handle this case" );
37573758
3758- appendClosureComponents (closure->getType (), closure->getDiscriminator (),
3759+ appendClosureComponents (canType,
3760+ closure->getDiscriminator (),
37593761 closure->isImplicit (), closure->getParent (),
37603762 ArrayRef<GenericEnvironment *>());
37613763}
@@ -3769,17 +3771,18 @@ void ASTMangler::appendClosureEntity(const AbstractClosureExpr *closure) {
37693771 // code; the type-checker currently isn't strict about producing typed
37703772 // expression nodes when it fails. Once we enforce that, we can remove this.
37713773 if (!type)
3772- type = ErrorType::get (closure->getASTContext ());
3774+ type = CanType ( ErrorType::get (closure->getASTContext () ));
37733775
3774- if (type->hasLocalArchetype ())
3776+ auto canType = type->getCanonicalType ();
3777+ if (canType->hasLocalArchetype ())
37753778 capturedEnvs = closure->getCaptureInfo ().getGenericEnvironments ();
37763779
3777- appendClosureComponents (type , closure->getDiscriminator (),
3780+ appendClosureComponents (canType , closure->getDiscriminator (),
37783781 isa<AutoClosureExpr>(closure), closure->getParent (),
37793782 capturedEnvs);
37803783}
37813784
3782- void ASTMangler::appendClosureComponents (Type Ty, unsigned discriminator,
3785+ void ASTMangler::appendClosureComponents (CanType Ty, unsigned discriminator,
37833786 bool isImplicit,
37843787 const DeclContext *parentContext,
37853788 ArrayRef<GenericEnvironment *> capturedEnvs) {
@@ -3793,9 +3796,9 @@ void ASTMangler::appendClosureComponents(Type Ty, unsigned discriminator,
37933796
37943797 Ty = Ty.subst (MapLocalArchetypesOutOfContext (Sig, capturedEnvs),
37953798 MakeAbstractConformanceForGenericType (),
3796- SubstFlags::PreservePackExpansionLevel);
3799+ SubstFlags::PreservePackExpansionLevel)-> getCanonicalType () ;
37973800
3798- appendType (Ty-> getCanonicalType () , Sig);
3801+ appendType (Ty, Sig);
37993802 appendOperator (isImplicit ? " fu" : " fU" , Index (discriminator));
38003803}
38013804
0 commit comments