@@ -225,15 +225,6 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
225225 }
226226
227227 SILType getOpType (SILType Ty) {
228- // Substitute local archetypes, if we have any.
229- if (Ty.hasLocalArchetype () && !LocalArchetypeSubs.empty ()) {
230- Ty = Ty.subst (
231- Builder.getModule (),
232- QueryTypeSubstitutionMapOrIdentity{LocalArchetypeSubs},
233- MakeAbstractConformanceForGenericType (),
234- CanGenericSignature ());
235- }
236-
237228 return asImpl ().remapType (Ty);
238229 }
239230
@@ -439,17 +430,19 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
439430 SILLocation remapLocation (SILLocation Loc) { return Loc; }
440431 const SILDebugScope *remapScope (const SILDebugScope *DS) { return DS; }
441432 SILType remapType (SILType Ty) {
442- return Ty;
433+ // Substitute local archetypes, if we have any.
434+ if (Ty.hasLocalArchetype ()) {
435+ Ty = Ty.subst (Builder.getModule (), Functor, Functor,
436+ CanGenericSignature ());
437+ }
438+
439+ return Ty;
443440 }
444441
445442 CanType remapASTType (CanType ty) {
446443 // Substitute local archetypes, if we have any.
447- if (ty->hasLocalArchetype () && !LocalArchetypeSubs.empty ()) {
448- ty = ty.subst (
449- QueryTypeSubstitutionMapOrIdentity{LocalArchetypeSubs},
450- MakeAbstractConformanceForGenericType ()
451- )->getCanonicalType ();
452- }
444+ if (ty->hasLocalArchetype ())
445+ ty = ty.subst (Functor, Functor)->getCanonicalType ();
453446
454447 return ty;
455448 }
0 commit comments