File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -2650,6 +2650,12 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
2650
2650
2651
2651
TypeChecker::checkDeclAttributes (PD);
2652
2652
2653
+ // Explicity compute the requirement signature to detect errors.
2654
+ // Do this before visiting members, to avoid a request cycle if
2655
+ // a member referenecs another declaration whose generic signature
2656
+ // has a conformance requirement to this protocol.
2657
+ auto reqSig = PD->getRequirementSignature ().getRequirements ();
2658
+
2653
2659
// Check the members.
2654
2660
for (auto Member : PD->getMembers ())
2655
2661
visit (Member);
@@ -2663,9 +2669,6 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
2663
2669
if (!SF || SF->Kind != SourceFileKind::Interface)
2664
2670
TypeChecker::inferDefaultWitnesses (PD);
2665
2671
2666
- // Explicity compute the requirement signature to detect errors.
2667
- auto reqSig = PD->getRequirementSignature ().getRequirements ();
2668
-
2669
2672
if (PD->getASTContext ().TypeCheckerOpts .DebugGenericSignatures ) {
2670
2673
auto requirementsSig =
2671
2674
GenericSignature::get ({PD->getProtocolSelfType ()}, reqSig);
Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift
2
+
3
+ protocol P {
4
+ associatedtype X
5
+ associatedtype Y where Y : Q
6
+ }
7
+
8
+ protocol Q {
9
+ associatedtype T
10
+ }
11
+
12
+ struct S : Q {
13
+ typealias T = Int
14
+ }
15
+
16
+ extension P where X == ( ) {
17
+ typealias Y = S
18
+ }
You can’t perform that action at this time.
0 commit comments