@@ -3974,6 +3974,9 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
3974
3974
3975
3975
DeclVisitor<DeclChecker>::visit (decl);
3976
3976
3977
+ if (IsFirstPass)
3978
+ TC.checkUnsupportedProtocolType (decl);
3979
+
3977
3980
if (auto VD = dyn_cast<ValueDecl>(decl)) {
3978
3981
checkRedeclaration (TC, VD);
3979
3982
@@ -3995,17 +3998,6 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
3995
3998
" `" + VD->getBaseName ().userFacingName ().str () + " `" );
3996
3999
}
3997
4000
}
3998
-
3999
- if (!IsFirstPass) {
4000
- TC.checkUnsupportedProtocolType (decl);
4001
- if (auto nominal = dyn_cast<NominalTypeDecl>(decl)) {
4002
- TC.checkDeclCircularity (nominal);
4003
- }
4004
- if (auto protocol = dyn_cast<ProtocolDecl>(decl)) {
4005
- if (protocol->isResilient ())
4006
- TC.inferDefaultWitnesses (protocol);
4007
- }
4008
- }
4009
4001
}
4010
4002
4011
4003
// ===--------------------------------------------------------------------===//
@@ -4393,6 +4385,8 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
4393
4385
// enums haven't.
4394
4386
checkEnumRawValues (TC, ED);
4395
4387
}
4388
+
4389
+ TC.checkDeclCircularity (ED);
4396
4390
}
4397
4391
4398
4392
void visitStructDecl (StructDecl *SD) {
@@ -4419,6 +4413,8 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
4419
4413
4420
4414
TC.checkDeclAttributes (SD);
4421
4415
checkAccessControl (TC, SD);
4416
+
4417
+ TC.checkDeclCircularity (SD);
4422
4418
}
4423
4419
4424
4420
// / Check whether the given properties can be @NSManaged in this class.
@@ -4651,6 +4647,8 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
4651
4647
4652
4648
TC.checkDeclAttributes (CD);
4653
4649
checkAccessControl (TC, CD);
4650
+
4651
+ TC.checkDeclCircularity (CD);
4654
4652
}
4655
4653
4656
4654
void visitProtocolDecl (ProtocolDecl *PD) {
@@ -4707,6 +4705,10 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
4707
4705
GenericTypeToArchetypeResolver resolver (PD);
4708
4706
TC.validateWhereClauses (PD, &resolver);
4709
4707
4708
+ TC.checkDeclCircularity (PD);
4709
+ if (PD->isResilient ())
4710
+ TC.inferDefaultWitnesses (PD);
4711
+
4710
4712
if (TC.Context .LangOpts .DebugGenericSignatures ) {
4711
4713
auto requirementsSig =
4712
4714
GenericSignature::get ({PD->getProtocolSelfType ()},
0 commit comments