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 @@ -3735,10 +3735,18 @@ void ParameterizedProtocolType::getRequirements(
37353735 for (unsigned i : indices (argTypes)) {
37363736 auto argType = argTypes[i];
37373737 auto *assocType = assocTypes[i];
3738- // Do a general type substitution here because the associated type might be
3739- // from an inherited protocol, in which case we will evaluate a non-trivial
3740- // conformance path.
3741- auto subjectType = assocType->getDeclaredInterfaceType ().subst (subMap);
3738+
3739+ Type subjectType;
3740+ if (baseType->isTypeParameter ()) {
3741+ // Fast path.
3742+ subjectType = DependentMemberType::get (baseType, assocType);
3743+ } else {
3744+ // Do a general type substitution here because the associated type might be
3745+ // from an inherited protocol, in which case we will evaluate a non-trivial
3746+ // conformance path.
3747+ subjectType = assocType->getDeclaredInterfaceType ().subst (subMap);
3748+ }
3749+
37423750 reqs.emplace_back (RequirementKind::SameType, subjectType, argType);
37433751 }
37443752}
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