@@ -1276,6 +1276,17 @@ class AccessorConformanceInfo : public ConformanceInfo {
1276
1276
}
1277
1277
return *Fulfillments;
1278
1278
}
1279
+
1280
+ void bindArchetypeAccessPathsInConformance (IRGenFunction &IGF) {
1281
+ auto declCtx = Conformance.getDeclContext ();
1282
+ if (auto generics = declCtx->getGenericSignatureOfContext ()) {
1283
+ auto getInContext = [&](CanType type) -> CanType {
1284
+ return ArchetypeBuilder::mapTypeIntoContext (declCtx, type, nullptr )
1285
+ ->getCanonicalType ();
1286
+ };
1287
+ bindArchetypeAccessPaths (IGF, generics, getInContext);
1288
+ }
1289
+ }
1279
1290
};
1280
1291
}
1281
1292
@@ -1335,6 +1346,9 @@ getAssociatedTypeMetadataAccessFunction(AssociatedTypeDecl *requirement,
1335
1346
// Bind local type data from the metadata argument.
1336
1347
IGF.bindLocalTypeDataFromTypeMetadata (ConcreteType, IsExact, self);
1337
1348
1349
+ // Bind archetype access paths.
1350
+ bindArchetypeAccessPathsInConformance (IGF);
1351
+
1338
1352
// For now, assume that an associated type is cheap enough to access
1339
1353
// that it doesn't need a new cache entry.
1340
1354
if (auto archetype = dyn_cast<ArchetypeType>(associatedType)) {
@@ -1458,6 +1472,9 @@ getAssociatedTypeWitnessTableAccessFunction(AssociatedTypeDecl *requirement,
1458
1472
associatedTypeMetadata);
1459
1473
IGF.bindLocalTypeDataFromTypeMetadata (ConcreteType, IsExact, self);
1460
1474
1475
+ // Bind archetype access paths.
1476
+ bindArchetypeAccessPathsInConformance (IGF);
1477
+
1461
1478
// For now, assume that finding an abstract conformance is always
1462
1479
// fast enough that it's not worth caching.
1463
1480
// TODO: provide an API to find the best metadata path to the conformance
@@ -1832,9 +1849,8 @@ void addPotentialArchetypeAccessPath(IRGenFunction &IGF,
1832
1849
{srcBaseArchetype, association});
1833
1850
}
1834
1851
1835
- static void bindArchetypeAccessPaths (IRGenFunction &IGF,
1836
- GenericSignature *Generics,
1837
- GetTypeParameterInContextFn getInContext) {
1852
+ void irgen::bindArchetypeAccessPaths (IRGenFunction &IGF, GenericSignature *Generics,
1853
+ GetTypeParameterInContextFn getInContext) {
1838
1854
// Remember all the extra ways we have of reaching the parameter
1839
1855
// archetypes due to type equality constraints.
1840
1856
for (auto reqt : Generics->getRequirements ()) {
0 commit comments