Skip to content

Commit be9d999

Browse files
committed
AST: Simplify GenericSignature::getLocalRequirements()
1 parent 4923521 commit be9d999

File tree

4 files changed

+5
-19
lines changed

4 files changed

+5
-19
lines changed

include/swift/AST/GenericSignature.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@ class GenericSignature {
170170
/// Stores a set of requirements on a type parameter. Used by
171171
/// GenericEnvironment for building archetypes.
172172
struct LocalRequirements {
173-
Type anchor;
174-
175-
Type concreteType;
176173
Type superclass;
177174

178175
RequiredProtocols protos;

lib/AST/GenericSignature.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,7 @@ GenericSignature::LocalRequirements
327327
GenericSignatureImpl::getLocalRequirements(Type depType) const {
328328
assert(depType->isTypeParameter() && "Expected a type parameter here");
329329

330-
return getRequirementMachine()->getLocalRequirements(
331-
depType, getGenericParams());
330+
return getRequirementMachine()->getLocalRequirements(depType);
332331
}
333332

334333
ASTContext &GenericSignatureImpl::getASTContext() const {

lib/AST/RequirementMachine/GenericSignatureQueries.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,30 +48,21 @@ using namespace rewriting;
4848
/// Collects all requirements on a type parameter that are used to construct
4949
/// its ArchetypeType in a GenericEnvironment.
5050
GenericSignature::LocalRequirements
51-
RequirementMachine::getLocalRequirements(
52-
Type depType,
53-
ArrayRef<GenericTypeParamType *> genericParams) const {
51+
RequirementMachine::getLocalRequirements(Type depType) const {
5452
auto term = Context.getMutableTermForType(depType->getCanonicalType(),
5553
/*proto=*/nullptr);
5654
System.simplify(term);
5755
verify(term);
5856

5957
GenericSignature::LocalRequirements result;
60-
result.anchor = Map.getTypeForTerm(term, genericParams);
61-
result.packShape = getReducedShape(depType, genericParams);
58+
result.packShape = getReducedShape(depType, {});
6259

6360
auto *props = Map.lookUpProperties(term);
6461
if (!props)
6562
return result;
6663

67-
if (props->isConcreteType()) {
68-
result.concreteType = props->getConcreteType({}, term, Map);
69-
return result;
70-
}
71-
72-
if (props->hasSuperclassBound()) {
64+
if (props->hasSuperclassBound())
7365
result.superclass = props->getSuperclassBound({}, term, Map);
74-
}
7566

7667
for (const auto *proto : props->getConformsTo())
7768
result.protos.push_back(const_cast<ProtocolDecl *>(proto));

lib/AST/RequirementMachine/RequirementMachine.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ class RequirementMachine final {
140140
// Generic signature queries. Generally you shouldn't have to construct a
141141
// RequirementMachine instance; instead, call the corresponding methods on
142142
// GenericSignature, which lazily create a RequirementMachine for you.
143-
GenericSignature::LocalRequirements getLocalRequirements(Type depType,
144-
ArrayRef<GenericTypeParamType *> genericParams) const;
143+
GenericSignature::LocalRequirements getLocalRequirements(Type depType) const;
145144
bool requiresClass(Type depType) const;
146145
LayoutConstraint getLayoutConstraint(Type depType) const;
147146
bool requiresProtocol(Type depType, const ProtocolDecl *proto) const;

0 commit comments

Comments
 (0)