|
12 | 12 |
|
13 | 13 | #include "swift/SILOptimizer/Utils/Existential.h"
|
14 | 14 | #include "swift/AST/ConformanceLookup.h"
|
| 15 | +#include "swift/AST/LocalArchetypeRequirementCollector.h" |
15 | 16 | #include "swift/AST/ProtocolConformance.h"
|
16 | 17 | #include "swift/Basic/Assertions.h"
|
17 | 18 | #include "swift/SIL/BasicBlockUtils.h"
|
@@ -250,15 +251,20 @@ void ConcreteExistentialInfo::initializeSubstitutionMap(
|
250 | 251 | // Construct a single-generic-parameter substitution map directly to the
|
251 | 252 | // ConcreteType with this existential's full list of conformances.
|
252 | 253 | //
|
253 |
| - // NOTE: getOpenedExistentialSignature() generates the signature for passing an |
| 254 | + // NOTE: LocalArchetypeRequirementCollector generates the signature for passing an |
254 | 255 | // opened existential as a generic parameter. No opened archetypes are
|
255 | 256 | // actually involved here--the API is only used as a convenient way to create
|
256 | 257 | // a substitution map. Since opened archetypes have different conformances
|
257 | 258 | // than their corresponding existential, ExistentialConformances needs to be
|
258 | 259 | // filtered when using it with this (phony) generic signature.
|
259 |
| - CanGenericSignature ExistentialSig = |
260 |
| - M->getASTContext().getOpenedExistentialSignature(ExistentialType, |
261 |
| - GenericSignature()); |
| 260 | + |
| 261 | + auto &ctx = M->getASTContext(); |
| 262 | + LocalArchetypeRequirementCollector collector(ctx, CanGenericSignature()); |
| 263 | + collector.addOpenedExistential(ExistentialType); |
| 264 | + auto ExistentialSig = buildGenericSignature( |
| 265 | + ctx, collector.OuterSig, collector.Params, collector.Requirements, |
| 266 | + /*allowInverses=*/true).getCanonicalSignature(); |
| 267 | + |
262 | 268 | ExistentialSubs = SubstitutionMap::get(
|
263 | 269 | ExistentialSig, [&](SubstitutableType *type) { return ConcreteType; },
|
264 | 270 | [&](CanType /*depType*/, Type /*replaceType*/,
|
|
0 commit comments