|
36 | 36 | #include "swift/AST/IndexSubset.h"
|
37 | 37 | #include "swift/AST/KnownProtocols.h"
|
38 | 38 | #include "swift/AST/LazyResolver.h"
|
| 39 | +#include "swift/AST/LocalArchetypeRequirementCollector.h" |
39 | 40 | #include "swift/AST/MacroDiscriminatorContext.h"
|
40 | 41 | #include "swift/AST/ModuleDependencies.h"
|
41 | 42 | #include "swift/AST/ModuleLoader.h"
|
@@ -5900,33 +5901,25 @@ ASTContext::getOpenedExistentialSignature(Type type, GenericSignature parentSig)
|
5900 | 5901 | type = existential->getConstraintType();
|
5901 | 5902 |
|
5902 | 5903 | const CanType constraint = type->getCanonicalType();
|
5903 |
| - assert(parentSig || !constraint->hasTypeParameter() && |
5904 |
| - "Interface type here requires a parent signature"); |
5905 | 5904 |
|
5906 | 5905 | auto canParentSig = parentSig.getCanonicalSignature();
|
5907 | 5906 | auto key = std::make_pair(constraint, canParentSig.getPointer());
|
5908 | 5907 | auto found = getImpl().ExistentialSignatures.find(key);
|
5909 | 5908 | if (found != getImpl().ExistentialSignatures.end())
|
5910 | 5909 | return found->second;
|
5911 | 5910 |
|
5912 |
| - auto genericParam = OpenedArchetypeType::getSelfInterfaceTypeFromContext( |
5913 |
| - canParentSig, *this) |
5914 |
| - ->castTo<GenericTypeParamType>(); |
5915 |
| - Requirement requirement(RequirementKind::Conformance, genericParam, |
5916 |
| - constraint); |
| 5911 | + LocalArchetypeRequirementCollector collector(*this, canParentSig); |
| 5912 | + collector.addOpenedExistential(type); |
5917 | 5913 | auto genericSig = buildGenericSignature(
|
5918 |
| - *this, canParentSig, |
5919 |
| - {genericParam}, {requirement}, |
5920 |
| - /*allowInverses=*/true); |
5921 |
| - |
5922 |
| - CanGenericSignature canGenericSig(genericSig); |
| 5914 | + *this, collector.OuterSig, collector.Params, collector.Requirements, |
| 5915 | + /*allowInverses=*/true).getCanonicalSignature(); |
5923 | 5916 |
|
5924 | 5917 | auto result = getImpl().ExistentialSignatures.insert(
|
5925 |
| - std::make_pair(key, canGenericSig)); |
| 5918 | + std::make_pair(key, genericSig)); |
5926 | 5919 | assert(result.second);
|
5927 | 5920 | (void) result;
|
5928 | 5921 |
|
5929 |
| - return canGenericSig; |
| 5922 | + return genericSig; |
5930 | 5923 | }
|
5931 | 5924 |
|
5932 | 5925 | CanGenericSignature
|
|
0 commit comments