File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed
Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -3754,10 +3754,18 @@ void ParameterizedProtocolType::getRequirements(
37543754 for (unsigned i : indices (argTypes)) {
37553755 auto argType = argTypes[i];
37563756 auto *assocType = assocTypes[i];
3757- // Do a general type substitution here because the associated type might be
3758- // from an inherited protocol, in which case we will evaluate a non-trivial
3759- // conformance path.
3760- auto subjectType = assocType->getDeclaredInterfaceType ().subst (subMap);
3757+
3758+ Type subjectType;
3759+ if (baseType->isTypeParameter ()) {
3760+ // Fast path.
3761+ subjectType = DependentMemberType::get (baseType, assocType);
3762+ } else {
3763+ // Do a general type substitution here because the associated type might be
3764+ // from an inherited protocol, in which case we will evaluate a non-trivial
3765+ // conformance path.
3766+ subjectType = assocType->getDeclaredInterfaceType ().subst (subMap);
3767+ }
3768+
37613769 reqs.emplace_back (RequirementKind::SameType, subjectType, argType);
37623770 }
37633771}
Original file line number Diff line number Diff line change 1+ // RUN: %target-typecheck-verify-swift
2+
3+ protocol P1 {
4+ associatedtype A
5+ associatedtype B
6+ }
7+
8+ protocol P2 < A> : P1 where B: P2 < A > { }
You can’t perform that action at this time.
0 commit comments