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