@@ -5201,7 +5201,8 @@ ASTContext::getOpenedArchetypeSignature(Type type, GenericSignature parentSig) {
52015201 type = existential->getConstraintType ();
52025202
52035203 const CanType constraint = type->getCanonicalType ();
5204- assert (!constraint->hasTypeParameter () && " This only works with archetypes" );
5204+ assert (parentSig || !constraint->hasTypeParameter () &&
5205+ " Interface type here requires a parent signature" );
52055206
52065207 // The opened archetype signature for a protocol type is identical
52075208 // to the protocol's own canonical generic signature if there aren't any
@@ -5216,11 +5217,13 @@ ASTContext::getOpenedArchetypeSignature(Type type, GenericSignature parentSig) {
52165217 // generic parameters. This ensures that we keep e.g. generic superclass
52175218 // existentials contained in a well-formed generic context.
52185219 auto canParentSig = parentSig.getCanonicalSignature ();
5219- auto found = getImpl ().ExistentialSignatures .find ({constraint, canParentSig.getPointer ()});
5220+ auto key = std::make_pair (constraint, canParentSig.getPointer ());
5221+ auto found = getImpl ().ExistentialSignatures .find (key);
52205222 if (found != getImpl ().ExistentialSignatures .end ())
52215223 return found->second ;
52225224
5223- auto genericParam = OpenedArchetypeType::getSelfInterfaceTypeFromContext (canParentSig, type->getASTContext ())
5225+ auto genericParam = OpenedArchetypeType::getSelfInterfaceTypeFromContext (
5226+ canParentSig, type->getASTContext ())
52245227 ->castTo <GenericTypeParamType>();
52255228 Requirement requirement (RequirementKind::Conformance, genericParam,
52265229 constraint);
0 commit comments