@@ -1440,7 +1440,7 @@ void swift::configureConstructorType(ConstructorDecl *ctor,
14401440 fnType = FunctionType::get (argType, resultType, extInfo);
14411441 }
14421442 Type selfMetaType = MetatypeType::get (selfType->getInOutObjectType ());
1443- if (outerGenericParams ) {
1443+ if (ctor-> getDeclContext ()-> isGenericTypeContext () ) {
14441444 allocFnType = PolymorphicFunctionType::get (selfMetaType, fnType,
14451445 outerGenericParams);
14461446 initFnType = PolymorphicFunctionType::get (selfType, fnType,
@@ -3671,7 +3671,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
36713671 GenericParamList *outerGenericParams = nullptr ;
36723672 auto patterns = FD->getBodyParamPatterns ();
36733673 bool hasSelf = FD->getDeclContext ()->isTypeContext ();
3674- if (hasSelf )
3674+ if (FD-> getDeclContext ()-> isGenericTypeContext () )
36753675 outerGenericParams = FD->getDeclContext ()->getGenericParamsOfContext ();
36763676
36773677 for (unsigned i = 0 , e = patterns.size (); i != e; ++i) {
@@ -4042,7 +4042,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
40424042 // Assign archetypes.
40434043 finalizeGenericParamList (builder, gp, FD, TC);
40444044 }
4045- } else if (outerGenericParams ) {
4045+ } else if (FD-> getDeclContext ()-> isGenericTypeContext () ) {
40464046 if (TC.validateGenericFuncSignature (FD)) {
40474047 markInvalidGenericSignature (FD, TC);
40484048 } else if (!FD->hasType ()) {
@@ -5168,7 +5168,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
51685168 auto resultTy = TC.getInterfaceTypeFromInternalType (enumDecl,
51695169 funcTy->getResult ());
51705170 auto interfaceTy
5171- = GenericFunctionType::get (enumDecl->getGenericSignature (),
5171+ = GenericFunctionType::get (enumDecl->getGenericSignatureOfContext (),
51725172 inputTy, resultTy, funcTy->getExtInfo ());
51735173
51745174 // Record the interface type.
@@ -5247,7 +5247,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
52475247 // case the enclosing enum type was illegally declared inside of a generic
52485248 // context. (In that case, we'll post a diagnostic while visiting the
52495249 // parent enum.)
5250- if (ED-> getGenericParams ())
5250+ if (EED-> getDeclContext ()-> isGenericTypeContext ())
52515251 computeEnumElementInterfaceType (EED);
52525252
52535253 // Require the carried type to be materializable.
@@ -5419,7 +5419,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
54195419 // Assign archetypes.
54205420 finalizeGenericParamList (builder, gp, CD, TC);
54215421 }
5422- } else if (outerGenericParams ) {
5422+ } else if (CD-> getDeclContext ()-> isGenericTypeContext () ) {
54235423 if (TC.validateGenericFuncSignature (CD)) {
54245424 CD->setInvalid ();
54255425 } else {
@@ -5565,7 +5565,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
55655565 GenericParamList *outerGenericParams;
55665566 Type SelfTy = configureImplicitSelf (TC, DD, outerGenericParams);
55675567
5568- if (outerGenericParams )
5568+ if (DD-> getDeclContext ()-> isGenericTypeContext () )
55695569 TC.validateGenericFuncSignature (DD);
55705570
55715571 if (semaFuncParamPatterns (DD)) {
@@ -5574,7 +5574,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
55745574 }
55755575
55765576 Type FnTy;
5577- if (outerGenericParams )
5577+ if (DD-> getDeclContext ()-> isGenericTypeContext () )
55785578 FnTy = PolymorphicFunctionType::get (SelfTy,
55795579 TupleType::getEmpty (TC.Context ),
55805580 outerGenericParams);
0 commit comments