@@ -200,29 +200,16 @@ void PolymorphicConvention::addPseudogenericFulfillments() {
200
200
void PolymorphicConvention::enumerateRequirements (const RequirementCallback &callback) {
201
201
if (!Generics) return ;
202
202
203
- // Make a first pass to get all the type metadata.
204
- for (auto &reqt : Generics->getRequirements ()) {
205
- switch (reqt.getKind ()) {
206
- // Ignore these; they don't introduce extra requirements.
207
- case RequirementKind::Superclass:
208
- case RequirementKind::SameType:
209
- case RequirementKind::Conformance:
210
- continue ;
211
-
212
- case RequirementKind::WitnessMarker: {
213
- CanType type = CanType (reqt.getFirstType ());
214
- if (isa<GenericTypeParamType>(type))
215
- callback ({type, nullptr });
216
- continue ;
217
- }
218
- }
219
- llvm_unreachable (" bad requirement kind" );
203
+ // Get all of the type metadata.
204
+ for (auto gp : Generics.getGenericParams ()) {
205
+ if (Generics->getCanonicalTypeInContext (gp, M) == gp)
206
+ callback ({gp, nullptr });
220
207
}
221
208
222
- // Make a second pass for all the protocol conformances.
209
+ // Get the protocol conformances.
223
210
for (auto &reqt : Generics->getRequirements ()) {
224
211
switch (reqt.getKind ()) {
225
- // Ignore these; they don't introduce extra requirements.
212
+ // Ignore these; they don't introduce extra requirements.
226
213
case RequirementKind::Superclass:
227
214
case RequirementKind::SameType:
228
215
case RequirementKind::WitnessMarker:
0 commit comments