@@ -195,9 +195,9 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
195195 if (Subs.hasLocalArchetypes ()) {
196196 // If we found a type containing a local archetype, substitute
197197 // open existentials throughout the substitution map.
198- Subs = Subs.subst (QueryTypeSubstitutionMapOrIdentity{
199- LocalArchetypeSubs} ,
200- MakeAbstractConformanceForGenericType () );
198+ Subs = Subs.subst (QueryTypeSubstitutionMapOrIdentity{LocalArchetypeSubs},
199+ MakeAbstractConformanceForGenericType () ,
200+ SubstFlags::PreservePackExpansionLevel );
201201 }
202202 }
203203
@@ -220,7 +220,9 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
220220 return Ty.subst (
221221 Builder.getModule (),
222222 QueryTypeSubstitutionMapOrIdentity{LocalArchetypeSubs},
223- MakeAbstractConformanceForGenericType ());
223+ MakeAbstractConformanceForGenericType (),
224+ CanGenericSignature (),
225+ SubstFlags::PreservePackExpansionLevel);
224226 }
225227 SILType getOpType (SILType Ty) {
226228 Ty = getTypeInClonedContext (Ty);
@@ -239,7 +241,8 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
239241
240242 return ty.subst (
241243 QueryTypeSubstitutionMapOrIdentity{LocalArchetypeSubs},
242- MakeAbstractConformanceForGenericType ()
244+ MakeAbstractConformanceForGenericType (),
245+ SubstFlags::PreservePackExpansionLevel
243246 )->getCanonicalType ();
244247 }
245248
@@ -352,7 +355,8 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
352355 conformance.subst (ty,
353356 QueryTypeSubstitutionMapOrIdentity{
354357 LocalArchetypeSubs},
355- MakeAbstractConformanceForGenericType ());
358+ MakeAbstractConformanceForGenericType (),
359+ SubstFlags::PreservePackExpansionLevel);
356360 }
357361
358362 return asImpl ().remapConformance (getASTTypeInClonedContext (ty),
0 commit comments