@@ -166,18 +166,6 @@ static void desugarLayoutRequirement(Type subjectType,
166
166
result.emplace_back (RequirementKind::Layout, subjectType, layout);
167
167
}
168
168
169
- static Type lookupMemberType (Type subjectType, ProtocolDecl *protoDecl,
170
- AssociatedTypeDecl *assocType) {
171
- if (subjectType->isTypeParameter ())
172
- return DependentMemberType::get (subjectType, assocType);
173
-
174
- auto *M = protoDecl->getParentModule ();
175
- auto conformance = M->lookupConformance (
176
- subjectType, protoDecl);
177
- return conformance.getAssociatedType (subjectType,
178
- assocType->getDeclaredInterfaceType ());
179
- }
180
-
181
169
// / Desugar a protocol conformance requirement by splitting up protocol
182
170
// / compositions on the right hand side into conformance and superclass
183
171
// / requirements.
@@ -363,8 +351,9 @@ struct InferRequirementsWalker : public TypeWalker {
363
351
};
364
352
auto addSameTypeConstraint = [&](Type firstType,
365
353
AssociatedTypeDecl *assocType) {
366
- auto *protocol = assocType->getProtocol ();
367
- auto secondType = lookupMemberType (firstType, protocol, assocType);
354
+ auto secondType = assocType->getDeclaredInterfaceType ()
355
+ ->castTo <DependentMemberType>()
356
+ ->substBaseType (module , firstType);
368
357
Requirement req (RequirementKind::SameType, firstType, secondType);
369
358
desugarRequirement (req, reqs, errors);
370
359
};
0 commit comments