@@ -37,22 +37,20 @@ RequirementMachine::getLocalRequirements(
3737 System.simplify (term);
3838 verify (term);
3939
40- auto &protos = System.getProtocols ();
41-
4240 GenericSignature::LocalRequirements result;
43- result.anchor = Context.getTypeForTerm (term, genericParams, protos );
41+ result.anchor = Context.getTypeForTerm (term, genericParams);
4442
4543 auto *props = Map.lookUpProperties (term);
4644 if (!props)
4745 return result;
4846
4947 if (props->isConcreteType ()) {
50- result.concreteType = props->getConcreteType ({}, term, protos, Context);
48+ result.concreteType = props->getConcreteType ({}, term, Context);
5149 return result;
5250 }
5351
5452 if (props->hasSuperclassBound ()) {
55- result.superclass = props->getSuperclassBound ({}, term, protos, Context);
53+ result.superclass = props->getSuperclassBound ({}, term, Context);
5654 }
5755
5856 for (const auto *proto : props->getConformsToExcludingSuperclassConformances ())
@@ -154,8 +152,7 @@ getSuperclassBound(Type depType,
154152 if (!props->hasSuperclassBound ())
155153 return Type ();
156154
157- auto &protos = System.getProtocols ();
158- return props->getSuperclassBound (genericParams, term, protos, Context);
155+ return props->getSuperclassBound (genericParams, term, Context);
159156}
160157
161158bool RequirementMachine::isConcreteType (Type depType) const {
@@ -186,8 +183,7 @@ getConcreteType(Type depType,
186183 if (!props->isConcreteType ())
187184 return Type ();
188185
189- auto &protos = System.getProtocols ();
190- return props->getConcreteType (genericParams, term, protos, Context);
186+ return props->getConcreteType (genericParams, term, Context);
191187}
192188
193189bool RequirementMachine::areSameTypeParameterInContext (Type depType1,
@@ -217,9 +213,6 @@ RequirementMachine::getLongestValidPrefix(const MutableTerm &term) const {
217213 case Symbol::Kind::Protocol:
218214 assert (prefix.empty () &&
219215 " Protocol symbol can only appear at the start of a type term" );
220- if (!System.getProtocols ().isKnownProtocol (symbol.getProtocol ()))
221- return prefix;
222-
223216 break ;
224217
225218 case Symbol::Kind::GenericParam:
@@ -235,9 +228,6 @@ RequirementMachine::getLongestValidPrefix(const MutableTerm &term) const {
235228 auto conformsTo = props->getConformsTo ();
236229
237230 for (const auto *proto : symbol.getProtocols ()) {
238- if (!System.getProtocols ().isKnownProtocol (proto))
239- return prefix;
240-
241231 // T.[P:A] is valid iff T conforms to P.
242232 if (std::find (conformsTo.begin (), conformsTo.end (), proto)
243233 == conformsTo.end ())
@@ -268,8 +258,6 @@ RequirementMachine::getLongestValidPrefix(const MutableTerm &term) const {
268258// / not considered canonical, since they can be replaced with their
269259// / concrete type).
270260bool RequirementMachine::isCanonicalTypeInContext (Type type) const {
271- auto &protos = System.getProtocols ();
272-
273261 // Look for non-canonical type parameters.
274262 return !type.findIf ([&](Type component) -> bool {
275263 if (!component->isTypeParameter ())
@@ -288,7 +276,7 @@ bool RequirementMachine::isCanonicalTypeInContext(Type type) const {
288276 if (props->isConcreteType ())
289277 return true ;
290278
291- auto anchor = Context.getTypeForTerm (term, {}, protos );
279+ auto anchor = Context.getTypeForTerm (term, {});
292280 return CanType (anchor) != CanType (component);
293281 });
294282}
@@ -304,7 +292,6 @@ bool RequirementMachine::isCanonicalTypeInContext(Type type) const {
304292Type RequirementMachine::getCanonicalTypeInContext (
305293 Type type,
306294 TypeArrayView<GenericTypeParamType> genericParams) const {
307- const auto &protos = System.getProtocols ();
308295
309296 return type.transformRec ([&](Type t) -> Optional<Type> {
310297 if (!t->isTypeParameter ())
@@ -353,8 +340,7 @@ Type RequirementMachine::getCanonicalTypeInContext(
353340 if (props) {
354341 if (props->isConcreteType ()) {
355342 auto concreteType = props->getConcreteType (genericParams,
356- prefix, protos,
357- Context);
343+ prefix, Context);
358344 if (!concreteType->hasTypeParameter ())
359345 return concreteType;
360346
@@ -369,8 +355,7 @@ Type RequirementMachine::getCanonicalTypeInContext(
369355 if (props->hasSuperclassBound () &&
370356 prefix.size () != term.size ()) {
371357 auto superclass = props->getSuperclassBound (genericParams,
372- prefix, protos,
373- Context);
358+ prefix, Context);
374359 if (!superclass->hasTypeParameter ())
375360 return superclass;
376361
@@ -379,7 +364,7 @@ Type RequirementMachine::getCanonicalTypeInContext(
379364 }
380365 }
381366
382- return Context.getTypeForTerm (prefix, genericParams, protos );
367+ return Context.getTypeForTerm (prefix, genericParams);
383368 }();
384369
385370 // If T is already valid, the longest valid prefix U of T is T itself, and
@@ -404,8 +389,7 @@ Type RequirementMachine::getCanonicalTypeInContext(
404389
405390 // Compute the type of the unresolved suffix term V, rooted in the
406391 // generic parameter τ_0_0.
407- auto origType = Context.getRelativeTypeForTerm (
408- term, prefix, System.getProtocols ());
392+ auto origType = Context.getRelativeTypeForTerm (term, prefix);
409393
410394 // Substitute τ_0_0 in the above relative type with the concrete type
411395 // for U.
0 commit comments