Skip to content

Commit 66ab887

Browse files
committed
RequirementMachine: Don't introduce rules for inherited associated types
The 'associated type merging' hack is a more general form of this.
1 parent 7bd7300 commit 66ab887

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

lib/AST/RequirementMachine.cpp

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ struct RewriteSystemBuilder {
4242
void addGenericSignature(CanGenericSignature sig);
4343
void addAssociatedType(const AssociatedTypeDecl *type,
4444
const ProtocolDecl *proto);
45-
void addInheritedAssociatedType(const AssociatedTypeDecl *type,
46-
const ProtocolDecl *inherited,
47-
const ProtocolDecl *proto);
4845
void addRequirement(const Requirement &req,
4946
const ProtocolDecl *proto);
5047
};
@@ -70,13 +67,6 @@ void RewriteSystemBuilder::addGenericSignature(CanGenericSignature sig) {
7067
for (auto *type : info.AssociatedTypes)
7168
addAssociatedType(type, proto);
7269

73-
for (auto *inherited : info.Inherited) {
74-
auto inheritedTypes = Protocols.getProtocolInfo(inherited).AssociatedTypes;
75-
for (auto *inheritedType : inheritedTypes) {
76-
addInheritedAssociatedType(inheritedType, inherited, proto);
77-
}
78-
}
79-
8070
for (auto req : info.Requirements)
8171
addRequirement(req.getCanonical(), proto);
8272

@@ -108,29 +98,6 @@ void RewriteSystemBuilder::addAssociatedType(const AssociatedTypeDecl *type,
10898
Rules.emplace_back(lhs, rhs);
10999
}
110100

111-
/// For an associated type T in a protocol Q that is inherited by another
112-
/// protocol P, we add a rewrite rule:
113-
///
114-
/// [P].[Q:T] => [P:T]
115-
///
116-
/// Intuitively this means, "if a type conforms to P, then the associated type
117-
/// T of Q is inherited by P".
118-
void RewriteSystemBuilder::addInheritedAssociatedType(
119-
const AssociatedTypeDecl *type,
120-
const ProtocolDecl *inherited,
121-
const ProtocolDecl *proto) {
122-
assert(inherited != proto);
123-
124-
Term lhs;
125-
lhs.add(Atom::forProtocol(proto, Context));
126-
lhs.add(Atom::forAssociatedType(inherited, type->getName(), Context));
127-
128-
Term rhs;
129-
rhs.add(Atom::forAssociatedType(proto, type->getName(), Context));
130-
131-
Rules.emplace_back(lhs, rhs);
132-
}
133-
134101
/// Lowers a generic requirement to a rewrite rule.
135102
///
136103
/// If \p proto is null, this is a generic requirement from the top-level

0 commit comments

Comments
 (0)