File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 3838
3939#include " swift/AST/ConformanceLookup.h"
4040#include " swift/AST/Decl.h"
41+ #include " swift/AST/GenericEnvironment.h"
4142#include " swift/AST/GenericSignature.h"
4243#include " swift/AST/NameLookupRequests.h"
4344#include " swift/AST/PrettyStackTrace.h"
@@ -2860,12 +2861,18 @@ bool AssociatedTypeInference::checkCurrentTypeWitnesses(
28602861 // Check any same-type requirements in the protocol's requirement signature.
28612862 SubstOptions options = getSubstOptionsWithCurrentTypeWitnesses ();
28622863
2863- auto typeInContext = dc->mapTypeIntoContext (adoptee);
2864+ auto typeInContext = adoptee;
2865+ ProtocolConformanceRef conformanceInContext (conformance);
2866+ if (auto *genericEnv = conformance->getGenericEnvironment ()) {
2867+ typeInContext = genericEnv->mapTypeIntoContext (typeInContext);
2868+ conformanceInContext =
2869+ conformanceInContext.subst (conformance->getType (),
2870+ genericEnv->getForwardingSubstitutionMap ());
2871+ }
28642872
28652873 auto substitutions =
28662874 SubstitutionMap::getProtocolSubstitutions (
2867- proto, typeInContext,
2868- ProtocolConformanceRef (conformance));
2875+ proto, typeInContext, conformanceInContext);
28692876
28702877 SmallVector<Requirement, 4 > sanitizedRequirements;
28712878 auto requirements = proto->getRequirementSignature ().getRequirements ();
You can’t perform that action at this time.
0 commit comments