@@ -157,8 +157,6 @@ class PolymorphicConvention {
157
157
}
158
158
159
159
private:
160
- void initGenerics ();
161
-
162
160
template <typename ...Args>
163
161
void considerNewTypeSource (IsExact_t isExact, MetadataSource::Kind kind,
164
162
CanType type, Args... args);
@@ -213,9 +211,8 @@ class PolymorphicConvention {
213
211
PolymorphicConvention::PolymorphicConvention (IRGenModule &IGM,
214
212
CanSILFunctionType fnType,
215
213
bool considerParameterSources = true )
216
- : IGM(IGM), M(*IGM.getSwiftModule()), FnType(fnType){
217
- initGenerics ();
218
-
214
+ : IGM(IGM), M(*IGM.getSwiftModule()), FnType(fnType),
215
+ Generics(fnType->getInvocationGenericSignature ()) {
219
216
auto rep = fnType->getRepresentation ();
220
217
221
218
if (fnType->isPseudogeneric ()) {
@@ -263,11 +260,8 @@ PolymorphicConvention::PolymorphicConvention(IRGenModule &IGM,
263
260
264
261
void PolymorphicConvention::addPseudogenericFulfillments () {
265
262
enumerateRequirements ([&](GenericRequirement reqt) {
266
- auto archetype = Generics.getGenericEnvironment ()
267
- ->mapTypeIntoContext (reqt.getTypeParameter ())
268
- ->getAs <ArchetypeType>();
269
- assert (archetype && " did not get an archetype by mapping param?" );
270
- auto erasedTypeParam = archetype->getExistentialType ()->getCanonicalType ();
263
+ auto erasedTypeParam = Generics->getExistentialType (reqt.getTypeParameter ())
264
+ ->getCanonicalType ();
271
265
Sources.emplace_back (MetadataSource::Kind::ErasedTypeMetadata,
272
266
reqt.getTypeParameter (), erasedTypeParam);
273
267
@@ -333,10 +327,6 @@ enumerateUnfulfilledRequirements(const RequirementCallback &callback) {
333
327
});
334
328
}
335
329
336
- void PolymorphicConvention::initGenerics () {
337
- Generics = FnType->getInvocationGenericSignature ();
338
- }
339
-
340
330
template <typename ...Args>
341
331
void PolymorphicConvention::considerNewTypeSource (IsExact_t isExact,
342
332
MetadataSource::Kind kind,
0 commit comments