@@ -192,50 +192,31 @@ void RequirementBuilder::addRequirementRules(ArrayRef<unsigned> rules) {
192
192
prop->getLayoutConstraint ());
193
193
return ;
194
194
195
- case Symbol::Kind::Superclass: {
196
- // Requirements containing unresolved name symbols originate from
197
- // invalid code and should not appear in the generic signature.
198
- for (auto term : prop->getSubstitutions ()) {
199
- if (term.containsUnresolvedSymbols ())
200
- return ;
201
- }
202
-
203
- Type superclassType = Map.getTypeFromSubstitutionSchema (
204
- prop->getConcreteType (),
205
- prop->getSubstitutions (),
206
- GenericParams, MutableTerm ());
207
- if (rule.isRecursive ())
208
- superclassType = replaceTypeParametersWithErrorTypes (superclassType);
209
-
210
- if (ReconstituteSugar)
211
- superclassType = superclassType->reconstituteSugar (/* recursive=*/ true );
212
-
213
- Reqs.emplace_back (RequirementKind::Superclass,
214
- subjectType, superclassType);
215
- return ;
216
- }
217
-
195
+ case Symbol::Kind::Superclass:
218
196
case Symbol::Kind::ConcreteType: {
219
- // Requirements containing unresolved name symbols originate from
220
- // invalid code and should not appear in the generic signature.
197
+ bool containsUnresolvedSymbols = false ;
221
198
for (auto term : prop->getSubstitutions ()) {
222
- if (term.containsUnresolvedSymbols ())
223
- return ;
199
+ containsUnresolvedSymbols |= term.containsUnresolvedSymbols ();
224
200
}
225
201
226
202
Type concreteType = Map.getTypeFromSubstitutionSchema (
227
203
prop->getConcreteType (),
228
204
prop->getSubstitutions (),
229
205
GenericParams, MutableTerm ());
230
- if (rule.isRecursive ())
206
+ if (containsUnresolvedSymbols || rule.isRecursive ())
231
207
concreteType = replaceTypeParametersWithErrorTypes (concreteType);
232
208
233
209
if (ReconstituteSugar)
234
210
concreteType = concreteType->reconstituteSugar (/* recursive=*/ true );
235
211
236
- auto &component = Components[rule.getRHS ()];
237
- assert (!component.ConcreteType );
238
- component.ConcreteType = concreteType;
212
+ if (prop->getKind () == Symbol::Kind::Superclass) {
213
+ Reqs.emplace_back (RequirementKind::Superclass,
214
+ subjectType, concreteType);
215
+ } else {
216
+ auto &component = Components[rule.getRHS ()];
217
+ assert (!component.ConcreteType );
218
+ component.ConcreteType = concreteType;
219
+ }
239
220
return ;
240
221
}
241
222
0 commit comments