@@ -37,22 +37,20 @@ RequirementMachine::getLocalRequirements(
37
37
System.simplify (term);
38
38
verify (term);
39
39
40
- auto &protos = System.getProtocols ();
41
-
42
40
GenericSignature::LocalRequirements result;
43
- result.anchor = Context.getTypeForTerm (term, genericParams, protos );
41
+ result.anchor = Context.getTypeForTerm (term, genericParams);
44
42
45
43
auto *props = Map.lookUpProperties (term);
46
44
if (!props)
47
45
return result;
48
46
49
47
if (props->isConcreteType ()) {
50
- result.concreteType = props->getConcreteType ({}, term, protos, Context);
48
+ result.concreteType = props->getConcreteType ({}, term, Context);
51
49
return result;
52
50
}
53
51
54
52
if (props->hasSuperclassBound ()) {
55
- result.superclass = props->getSuperclassBound ({}, term, protos, Context);
53
+ result.superclass = props->getSuperclassBound ({}, term, Context);
56
54
}
57
55
58
56
for (const auto *proto : props->getConformsToExcludingSuperclassConformances ())
@@ -154,8 +152,7 @@ getSuperclassBound(Type depType,
154
152
if (!props->hasSuperclassBound ())
155
153
return Type ();
156
154
157
- auto &protos = System.getProtocols ();
158
- return props->getSuperclassBound (genericParams, term, protos, Context);
155
+ return props->getSuperclassBound (genericParams, term, Context);
159
156
}
160
157
161
158
bool RequirementMachine::isConcreteType (Type depType) const {
@@ -186,8 +183,7 @@ getConcreteType(Type depType,
186
183
if (!props->isConcreteType ())
187
184
return Type ();
188
185
189
- auto &protos = System.getProtocols ();
190
- return props->getConcreteType (genericParams, term, protos, Context);
186
+ return props->getConcreteType (genericParams, term, Context);
191
187
}
192
188
193
189
bool RequirementMachine::areSameTypeParameterInContext (Type depType1,
@@ -217,9 +213,6 @@ RequirementMachine::getLongestValidPrefix(const MutableTerm &term) const {
217
213
case Symbol::Kind::Protocol:
218
214
assert (prefix.empty () &&
219
215
" Protocol symbol can only appear at the start of a type term" );
220
- if (!System.getProtocols ().isKnownProtocol (symbol.getProtocol ()))
221
- return prefix;
222
-
223
216
break ;
224
217
225
218
case Symbol::Kind::GenericParam:
@@ -235,9 +228,6 @@ RequirementMachine::getLongestValidPrefix(const MutableTerm &term) const {
235
228
auto conformsTo = props->getConformsTo ();
236
229
237
230
for (const auto *proto : symbol.getProtocols ()) {
238
- if (!System.getProtocols ().isKnownProtocol (proto))
239
- return prefix;
240
-
241
231
// T.[P:A] is valid iff T conforms to P.
242
232
if (std::find (conformsTo.begin (), conformsTo.end (), proto)
243
233
== conformsTo.end ())
@@ -268,8 +258,6 @@ RequirementMachine::getLongestValidPrefix(const MutableTerm &term) const {
268
258
// / not considered canonical, since they can be replaced with their
269
259
// / concrete type).
270
260
bool RequirementMachine::isCanonicalTypeInContext (Type type) const {
271
- auto &protos = System.getProtocols ();
272
-
273
261
// Look for non-canonical type parameters.
274
262
return !type.findIf ([&](Type component) -> bool {
275
263
if (!component->isTypeParameter ())
@@ -288,7 +276,7 @@ bool RequirementMachine::isCanonicalTypeInContext(Type type) const {
288
276
if (props->isConcreteType ())
289
277
return true ;
290
278
291
- auto anchor = Context.getTypeForTerm (term, {}, protos );
279
+ auto anchor = Context.getTypeForTerm (term, {});
292
280
return CanType (anchor) != CanType (component);
293
281
});
294
282
}
@@ -304,7 +292,6 @@ bool RequirementMachine::isCanonicalTypeInContext(Type type) const {
304
292
Type RequirementMachine::getCanonicalTypeInContext (
305
293
Type type,
306
294
TypeArrayView<GenericTypeParamType> genericParams) const {
307
- const auto &protos = System.getProtocols ();
308
295
309
296
return type.transformRec ([&](Type t) -> Optional<Type> {
310
297
if (!t->isTypeParameter ())
@@ -353,8 +340,7 @@ Type RequirementMachine::getCanonicalTypeInContext(
353
340
if (props) {
354
341
if (props->isConcreteType ()) {
355
342
auto concreteType = props->getConcreteType (genericParams,
356
- prefix, protos,
357
- Context);
343
+ prefix, Context);
358
344
if (!concreteType->hasTypeParameter ())
359
345
return concreteType;
360
346
@@ -369,8 +355,7 @@ Type RequirementMachine::getCanonicalTypeInContext(
369
355
if (props->hasSuperclassBound () &&
370
356
prefix.size () != term.size ()) {
371
357
auto superclass = props->getSuperclassBound (genericParams,
372
- prefix, protos,
373
- Context);
358
+ prefix, Context);
374
359
if (!superclass->hasTypeParameter ())
375
360
return superclass;
376
361
@@ -379,7 +364,7 @@ Type RequirementMachine::getCanonicalTypeInContext(
379
364
}
380
365
}
381
366
382
- return Context.getTypeForTerm (prefix, genericParams, protos );
367
+ return Context.getTypeForTerm (prefix, genericParams);
383
368
}();
384
369
385
370
// If T is already valid, the longest valid prefix U of T is T itself, and
@@ -404,8 +389,7 @@ Type RequirementMachine::getCanonicalTypeInContext(
404
389
405
390
// Compute the type of the unresolved suffix term V, rooted in the
406
391
// generic parameter τ_0_0.
407
- auto origType = Context.getRelativeTypeForTerm (
408
- term, prefix, System.getProtocols ());
392
+ auto origType = Context.getRelativeTypeForTerm (term, prefix);
409
393
410
394
// Substitute τ_0_0 in the above relative type with the concrete type
411
395
// for U.
0 commit comments