@@ -3752,10 +3752,12 @@ void ASTMangler::appendAssociatedTypeName(DependentMemberType *dmt,
3752
3752
3753
3753
void ASTMangler::appendClosureEntity (
3754
3754
const SerializedAbstractClosureExpr *closure) {
3755
- assert (!closure->getType ()->hasLocalArchetype () &&
3755
+ auto canType = closure->getType ()->getCanonicalType ();
3756
+ assert (!canType->hasLocalArchetype () &&
3756
3757
" Not enough information here to handle this case" );
3757
3758
3758
- appendClosureComponents (closure->getType (), closure->getDiscriminator (),
3759
+ appendClosureComponents (canType,
3760
+ closure->getDiscriminator (),
3759
3761
closure->isImplicit (), closure->getParent (),
3760
3762
ArrayRef<GenericEnvironment *>());
3761
3763
}
@@ -3769,17 +3771,18 @@ void ASTMangler::appendClosureEntity(const AbstractClosureExpr *closure) {
3769
3771
// code; the type-checker currently isn't strict about producing typed
3770
3772
// expression nodes when it fails. Once we enforce that, we can remove this.
3771
3773
if (!type)
3772
- type = ErrorType::get (closure->getASTContext ());
3774
+ type = CanType ( ErrorType::get (closure->getASTContext () ));
3773
3775
3774
- if (type->hasLocalArchetype ())
3776
+ auto canType = type->getCanonicalType ();
3777
+ if (canType->hasLocalArchetype ())
3775
3778
capturedEnvs = closure->getCaptureInfo ().getGenericEnvironments ();
3776
3779
3777
- appendClosureComponents (type , closure->getDiscriminator (),
3780
+ appendClosureComponents (canType , closure->getDiscriminator (),
3778
3781
isa<AutoClosureExpr>(closure), closure->getParent (),
3779
3782
capturedEnvs);
3780
3783
}
3781
3784
3782
- void ASTMangler::appendClosureComponents (Type Ty, unsigned discriminator,
3785
+ void ASTMangler::appendClosureComponents (CanType Ty, unsigned discriminator,
3783
3786
bool isImplicit,
3784
3787
const DeclContext *parentContext,
3785
3788
ArrayRef<GenericEnvironment *> capturedEnvs) {
@@ -3793,9 +3796,9 @@ void ASTMangler::appendClosureComponents(Type Ty, unsigned discriminator,
3793
3796
3794
3797
Ty = Ty.subst (MapLocalArchetypesOutOfContext (Sig, capturedEnvs),
3795
3798
MakeAbstractConformanceForGenericType (),
3796
- SubstFlags::PreservePackExpansionLevel);
3799
+ SubstFlags::PreservePackExpansionLevel)-> getCanonicalType () ;
3797
3800
3798
- appendType (Ty-> getCanonicalType () , Sig);
3801
+ appendType (Ty, Sig);
3799
3802
appendOperator (isImplicit ? " fu" : " fU" , Index (discriminator));
3800
3803
}
3801
3804
0 commit comments