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 38
38
39
39
#include " swift/AST/ConformanceLookup.h"
40
40
#include " swift/AST/Decl.h"
41
+ #include " swift/AST/GenericEnvironment.h"
41
42
#include " swift/AST/GenericSignature.h"
42
43
#include " swift/AST/NameLookupRequests.h"
43
44
#include " swift/AST/PrettyStackTrace.h"
@@ -2860,12 +2861,18 @@ bool AssociatedTypeInference::checkCurrentTypeWitnesses(
2860
2861
// Check any same-type requirements in the protocol's requirement signature.
2861
2862
SubstOptions options = getSubstOptionsWithCurrentTypeWitnesses ();
2862
2863
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
+ }
2864
2872
2865
2873
auto substitutions =
2866
2874
SubstitutionMap::getProtocolSubstitutions (
2867
- proto, typeInContext,
2868
- ProtocolConformanceRef (conformance));
2875
+ proto, typeInContext, conformanceInContext);
2869
2876
2870
2877
SmallVector<Requirement, 4 > sanitizedRequirements;
2871
2878
auto requirements = proto->getRequirementSignature ().getRequirements ();
You can’t perform that action at this time.
0 commit comments