mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Generalize ProtocolDecl::getRequirementSignature() to a new RequirementSignature type
The RequirementSignature generalizes the old ArrayRef<Requirement> which stores the minimal requirements that a conforming type's witnesses must satisfy, to also record the protocol typealiases defined in the protocol.
This commit is contained in:
@@ -564,7 +564,8 @@ void NormalProtocolConformance::setSignatureConformances(
|
||||
|
||||
#if !NDEBUG
|
||||
unsigned idx = 0;
|
||||
for (const auto &req : getProtocol()->getRequirementSignature()) {
|
||||
auto reqs = getProtocol()->getRequirementSignature().getRequirements();
|
||||
for (const auto &req : reqs) {
|
||||
if (req.getKind() == RequirementKind::Conformance) {
|
||||
assert(!conformances[idx].isConcrete() ||
|
||||
!conformances[idx].getConcrete()->getType()->hasArchetype() &&
|
||||
@@ -766,7 +767,8 @@ NormalProtocolConformance::getAssociatedConformance(Type assocType,
|
||||
"signature conformances not yet computed");
|
||||
|
||||
unsigned conformanceIndex = 0;
|
||||
for (const auto &reqt : getProtocol()->getRequirementSignature()) {
|
||||
auto requirements = getProtocol()->getRequirementSignature().getRequirements();
|
||||
for (const auto &reqt : requirements) {
|
||||
if (reqt.getKind() == RequirementKind::Conformance) {
|
||||
// Is this the conformance we're looking for?
|
||||
if (reqt.getFirstType()->isEqual(assocType) &&
|
||||
@@ -819,7 +821,7 @@ void NormalProtocolConformance::finishSignatureConformances() {
|
||||
return;
|
||||
|
||||
auto *proto = getProtocol();
|
||||
auto reqSig = proto->getRequirementSignature();
|
||||
auto reqSig = proto->getRequirementSignature().getRequirements();
|
||||
if (reqSig.empty())
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user