@@ -156,9 +156,14 @@ getSuperclassBound(Type depType,
156156 return props->getSuperclassBound (genericParams, term, Map);
157157}
158158
159- bool RequirementMachine::isConcreteType (Type depType) const {
159+ // / Unlike the other queries, we have occasion to call this on a requirement
160+ // / machine for a protocol connected component as well as a top-level
161+ // / generic signature, so plumb through the protocol to use for the root
162+ // / `Self` generic parameter here.
163+ bool RequirementMachine::isConcreteType (Type depType,
164+ const ProtocolDecl *proto) const {
160165 auto term = Context.getMutableTermForType (depType->getCanonicalType (),
161- /* proto= */ nullptr );
166+ proto);
162167 System.simplify (term);
163168 verify (term);
164169
@@ -169,11 +174,16 @@ bool RequirementMachine::isConcreteType(Type depType) const {
169174 return props->isConcreteType ();
170175}
171176
177+ // / Unlike the other queries, we have occasion to call this on a requirement
178+ // / machine for a protocol connected component as well as a top-level
179+ // / generic signature, so plumb through the protocol to use for the root
180+ // / `Self` generic parameter here.
172181Type RequirementMachine::
173182getConcreteType (Type depType,
174- TypeArrayView<GenericTypeParamType> genericParams) const {
183+ TypeArrayView<GenericTypeParamType> genericParams,
184+ const ProtocolDecl *proto) const {
175185 auto term = Context.getMutableTermForType (depType->getCanonicalType (),
176- /* proto= */ nullptr );
186+ proto);
177187 System.simplify (term);
178188 verify (term);
179189
@@ -683,9 +693,11 @@ void RequirementMachine::verify(const MutableTerm &term) const {
683693 if (term.begin ()->getKind () == Symbol::Kind::GenericParam) {
684694 auto *genericParam = term.begin ()->getGenericParam ();
685695 TypeArrayView<GenericTypeParamType> genericParams = getGenericParams ();
686- auto found = std::find (genericParams.begin (),
687- genericParams.end (),
688- genericParam);
696+ auto found = std::find_if (genericParams.begin (),
697+ genericParams.end (),
698+ [&](GenericTypeParamType *otherType) {
699+ return genericParam->isEqual (otherType);
700+ });
689701 if (found == genericParams.end ()) {
690702 llvm::errs () << " Bad generic parameter in " << term << " \n " ;
691703 dump (llvm::errs ());
0 commit comments