@@ -448,9 +448,9 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
448
448
449
449
SILLocation remapLocation (SILLocation Loc) { return Loc; }
450
450
const SILDebugScope *remapScope (const SILDebugScope *DS) { return DS; }
451
+
451
452
SILType remapType (SILType Ty) {
452
- // Substitute local archetypes, if we have any.
453
- if (Ty.hasLocalArchetype ()) {
453
+ if (Functor.SubsMap || Ty.hasLocalArchetype ()) {
454
454
Ty = Ty.subst (Builder.getModule (), Functor, Functor,
455
455
CanGenericSignature ());
456
456
}
@@ -459,16 +459,14 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
459
459
}
460
460
461
461
CanType remapASTType (CanType ty) {
462
- // Substitute local archetypes, if we have any.
463
- if (ty->hasLocalArchetype ())
462
+ if (Functor.SubsMap || ty->hasLocalArchetype ())
464
463
ty = ty.subst (Functor, Functor)->getCanonicalType ();
465
464
466
465
return ty;
467
466
}
468
467
469
468
ProtocolConformanceRef remapConformance (Type Ty, ProtocolConformanceRef C) {
470
- // If we have local archetypes to substitute, do so now.
471
- if (Ty->hasLocalArchetype ())
469
+ if (Functor.SubsMap || Ty->hasLocalArchetype ())
472
470
C = C.subst (Ty, Functor, Functor);
473
471
474
472
return C;
@@ -485,7 +483,7 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
485
483
486
484
SubstitutionMap remapSubstitutionMap (SubstitutionMap Subs) {
487
485
// If we have local archetypes to substitute, do so now.
488
- if (Subs.hasLocalArchetypes ())
486
+ if (Subs.hasLocalArchetypes () || Functor. SubsMap )
489
487
Subs = Subs.subst (Functor, Functor);
490
488
491
489
return Subs;
0 commit comments