@@ -195,9 +195,9 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
195
195
if (Subs.hasLocalArchetypes ()) {
196
196
// If we found a type containing a local archetype, substitute
197
197
// 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 );
201
201
}
202
202
}
203
203
@@ -220,7 +220,9 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
220
220
return Ty.subst (
221
221
Builder.getModule (),
222
222
QueryTypeSubstitutionMapOrIdentity{LocalArchetypeSubs},
223
- MakeAbstractConformanceForGenericType ());
223
+ MakeAbstractConformanceForGenericType (),
224
+ CanGenericSignature (),
225
+ SubstFlags::PreservePackExpansionLevel);
224
226
}
225
227
SILType getOpType (SILType Ty) {
226
228
Ty = getTypeInClonedContext (Ty);
@@ -239,7 +241,8 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
239
241
240
242
return ty.subst (
241
243
QueryTypeSubstitutionMapOrIdentity{LocalArchetypeSubs},
242
- MakeAbstractConformanceForGenericType ()
244
+ MakeAbstractConformanceForGenericType (),
245
+ SubstFlags::PreservePackExpansionLevel
243
246
)->getCanonicalType ();
244
247
}
245
248
@@ -352,7 +355,8 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
352
355
conformance.subst (ty,
353
356
QueryTypeSubstitutionMapOrIdentity{
354
357
LocalArchetypeSubs},
355
- MakeAbstractConformanceForGenericType ());
358
+ MakeAbstractConformanceForGenericType (),
359
+ SubstFlags::PreservePackExpansionLevel);
356
360
}
357
361
358
362
return asImpl ().remapConformance (getASTTypeInClonedContext (ty),
0 commit comments