@@ -502,11 +502,13 @@ static void checkInheritanceClause(
502
502
// / Check the inheritance clauses generic parameters along with any
503
503
// / requirements stored within the generic parameter list.
504
504
static void checkGenericParams (GenericParamList *genericParams,
505
- DeclContext *owningDC) {
505
+ DeclContext *owningDC,
506
+ TypeChecker &tc) {
506
507
if (!genericParams)
507
508
return ;
508
509
509
510
for (auto gp : *genericParams) {
511
+ tc.checkDeclAttributesEarly (gp);
510
512
checkInheritanceClause (gp);
511
513
}
512
514
@@ -645,7 +647,7 @@ TypeChecker::handleSILGenericParams(GenericParamList *genericParams,
645
647
646
648
for (unsigned i = 0 , e = nestedList.size (); i < e; i++) {
647
649
auto genericParams = nestedList.rbegin ()[i];
648
- prepareGenericParamList ( genericParams, DC );
650
+ genericParams-> configureGenericParamDepth ( );
649
651
650
652
parentEnv = checkGenericEnvironment (genericParams, DC, parentSig,
651
653
/* allowConcreteGenericParams=*/ true ,
@@ -2379,7 +2381,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
2379
2381
2380
2382
if (!SD->isInvalid ()) {
2381
2383
TC.checkReferencedGenericParams (SD);
2382
- checkGenericParams (SD->getGenericParams (), SD);
2384
+ checkGenericParams (SD->getGenericParams (), SD, TC );
2383
2385
TC.checkProtocolSelfRequirements (SD);
2384
2386
}
2385
2387
@@ -2488,7 +2490,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
2488
2490
2489
2491
checkUnsupportedNestedType (ED);
2490
2492
TC.validateDecl (ED);
2491
- checkGenericParams (ED->getGenericParams (), ED);
2493
+ checkGenericParams (ED->getGenericParams (), ED, TC );
2492
2494
2493
2495
{
2494
2496
// Check for circular inheritance of the raw type.
@@ -2525,7 +2527,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
2525
2527
checkUnsupportedNestedType (SD);
2526
2528
2527
2529
TC.validateDecl (SD);
2528
- checkGenericParams (SD->getGenericParams (), SD);
2530
+ checkGenericParams (SD->getGenericParams (), SD, TC );
2529
2531
2530
2532
TC.addImplicitConstructors (SD);
2531
2533
@@ -2653,7 +2655,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
2653
2655
2654
2656
TC.validateDecl (CD);
2655
2657
TC.requestSuperclassLayout (CD);
2656
- checkGenericParams (CD->getGenericParams (), CD);
2658
+ checkGenericParams (CD->getGenericParams (), CD, TC );
2657
2659
2658
2660
{
2659
2661
// Check for circular inheritance.
@@ -2898,7 +2900,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
2898
2900
TC.validateDecl (FD);
2899
2901
2900
2902
if (!FD->isInvalid ()) {
2901
- checkGenericParams (FD->getGenericParams (), FD);
2903
+ checkGenericParams (FD->getGenericParams (), FD, TC );
2902
2904
TC.checkReferencedGenericParams (FD);
2903
2905
TC.checkProtocolSelfRequirements (FD);
2904
2906
}
@@ -2976,8 +2978,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
2976
2978
}
2977
2979
}
2978
2980
2979
- if (auto genericParams = ED->getGenericParams ())
2980
- checkGenericParams (genericParams, ED);
2981
+ checkGenericParams (ED->getGenericParams (), ED, TC);
2981
2982
2982
2983
validateAttributes (TC, ED);
2983
2984
@@ -3025,7 +3026,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
3025
3026
TC.validateDecl (CD);
3026
3027
3027
3028
if (!CD->isInvalid ()) {
3028
- checkGenericParams (CD->getGenericParams (), CD);
3029
+ checkGenericParams (CD->getGenericParams (), CD, TC );
3029
3030
TC.checkReferencedGenericParams (CD);
3030
3031
TC.checkProtocolSelfRequirements (CD);
3031
3032
}
0 commit comments