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(
3735
3735
for (unsigned i : indices (argTypes)) {
3736
3736
auto argType = argTypes[i];
3737
3737
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
+
3742
3750
reqs.emplace_back (RequirementKind::SameType, subjectType, argType);
3743
3751
}
3744
3752
}
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