@@ -424,10 +424,10 @@ Type GenericSignatureImpl::getSuperclassBound(Type type) const {
424424 return equivClass->superclass ;
425425}
426426
427- // / Determine the set of protocols to which the given dependent type
428- // / must conform.
429- SmallVector<ProtocolDecl *, 2 >
430- GenericSignatureImpl::getConformsTo (Type type) const {
427+ // / Determine the set of protocols to which the given type parameter is
428+ // / required to conform.
429+ GenericSignature::RequiredProtocols
430+ GenericSignatureImpl::getRequiredProtocols (Type type) const {
431431 if (!type->isTypeParameter ()) return { };
432432
433433 auto &builder = *getGenericSignatureBuilder ();
@@ -437,12 +437,12 @@ GenericSignatureImpl::getConformsTo(Type type) const {
437437 ArchetypeResolutionKind::CompleteWellFormed);
438438 if (!equivClass) return { };
439439
440- // If this type was mapped to a concrete type, then there are no
441- // requirements.
440+ // If this type parameter was mapped to a concrete type, then there
441+ // are no requirements.
442442 if (equivClass->concreteType ) return { };
443443
444444 // Retrieve the protocols to which this type conforms.
445- SmallVector<ProtocolDecl *, 2 > result;
445+ GenericSignature::RequiredProtocols result;
446446 for (const auto &conforms : equivClass->conformsTo )
447447 result.push_back (conforms.first );
448448
@@ -452,8 +452,8 @@ GenericSignatureImpl::getConformsTo(Type type) const {
452452 return result;
453453}
454454
455- bool GenericSignatureImpl::conformsToProtocol (Type type,
456- ProtocolDecl *proto) const {
455+ bool GenericSignatureImpl::requiresProtocol (Type type,
456+ ProtocolDecl *proto) const {
457457 assert (type->isTypeParameter () && " Expected a type parameter" );
458458
459459 auto &builder = *getGenericSignatureBuilder ();
@@ -463,7 +463,11 @@ bool GenericSignatureImpl::conformsToProtocol(Type type,
463463 ArchetypeResolutionKind::CompleteWellFormed);
464464 if (!equivClass) return false ;
465465
466- // FIXME: Deal with concrete conformances here?
466+ // FIXME: Optionally deal with concrete conformances here
467+ // or have a separate method do that additionally?
468+ //
469+ // If this type parameter was mapped to a concrete type, then there
470+ // are no requirements.
467471 if (equivClass->concreteType ) return false ;
468472
469473 // Check whether the representative conforms to this protocol.
@@ -541,7 +545,7 @@ bool GenericSignatureImpl::isRequirementSatisfied(
541545 auto protocol = protocolType->getDecl ();
542546
543547 if (canFirstType->isTypeParameter ())
544- return conformsToProtocol (canFirstType, protocol);
548+ return requiresProtocol (canFirstType, protocol);
545549 else
546550 return (bool )GSB->lookupConformance (/* dependentType=*/ CanType (),
547551 canFirstType, protocol);
0 commit comments