Skip to content

Commit 7667047

Browse files
committed
AST: Remove InverseRequirement::enumerateDefaultedParams()
1 parent b8a6a9e commit 7667047

File tree

3 files changed

+3
-32
lines changed

3 files changed

+3
-32
lines changed

include/swift/AST/Requirement.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,6 @@ struct InverseRequirement {
251251

252252
InvertibleProtocolKind getKind() const;
253253

254-
/// Adds the type parameters of this generic context to the result if
255-
/// it has default requirements.
256-
static void enumerateDefaultedParams(GenericContext *decl,
257-
SmallVectorImpl<Type> &result);
258-
259254
/// Appends additional requirements corresponding to defaults for the given
260255
/// generic parameters.
261256
static void expandDefaults(ASTContext &ctx,

lib/AST/Requirement.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -316,32 +316,6 @@ InvertibleProtocolKind InverseRequirement::getKind() const {
316316
return *getInvertibleProtocolKind(*(protocol->getKnownProtocolKind()));
317317
}
318318

319-
void InverseRequirement::enumerateDefaultedParams(
320-
GenericContext *genericContext,
321-
SmallVectorImpl<Type> &result) {
322-
323-
auto add = [&](Type t) {
324-
assert(t->isTypeParameter());
325-
result.push_back(t);
326-
};
327-
328-
// Nothing to enumerate if it's not generic.
329-
if (!genericContext->isGeneric())
330-
return;
331-
332-
if (auto proto = dyn_cast<ProtocolDecl>(genericContext)) {
333-
add(proto->getSelfInterfaceType());
334-
335-
for (auto *assocTypeDecl : proto->getAssociatedTypeMembers())
336-
add(assocTypeDecl->getDeclaredInterfaceType());
337-
338-
return;
339-
}
340-
341-
for (GenericTypeParamDecl *gtpd : *genericContext->getGenericParams())
342-
add(gtpd->getDeclaredInterfaceType());
343-
}
344-
345319
void InverseRequirement::expandDefaults(
346320
ASTContext &ctx,
347321
ArrayRef<Type> gps,

lib/AST/RequirementMachine/RequirementLowering.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,9 @@ StructuralRequirementsRequest::evaluate(Evaluator &evaluator,
869869
SmallVector<InverseRequirement> inverses;
870870

871871
SmallVector<Type, 4> needsDefaultRequirements;
872-
InverseRequirement::enumerateDefaultedParams(proto, needsDefaultRequirements);
872+
needsDefaultRequirements.push_back(proto->getSelfInterfaceType());
873+
for (auto *assocTypeDecl : proto->getAssociatedTypeMembers())
874+
needsDefaultRequirements.push_back(assocTypeDecl->getDeclaredInterfaceType());
873875

874876
auto &ctx = proto->getASTContext();
875877
auto selfTy = proto->getSelfInterfaceType();

0 commit comments

Comments
 (0)