@@ -4354,42 +4354,28 @@ ASTContext::getOverrideGenericSignature(const ValueDecl *base,
4354
4354
auto derivedGenericCtx = derived->getAsGenericContext ();
4355
4355
auto &ctx = base->getASTContext ();
4356
4356
4357
- if (!baseGenericCtx) {
4357
+ if (!baseGenericCtx || !derivedGenericCtx)
4358
4358
return nullptr ;
4359
- }
4360
4359
4361
4360
auto baseClass = base->getDeclContext ()->getSelfClassDecl ();
4362
-
4363
- if (!baseClass) {
4361
+ if (!baseClass)
4364
4362
return nullptr ;
4365
- }
4366
4363
4367
4364
auto derivedClass = derived->getDeclContext ()->getSelfClassDecl ();
4368
- auto baseClassSig = baseClass->getGenericSignature ();
4369
-
4370
- if (!derivedClass) {
4365
+ if (!derivedClass)
4371
4366
return nullptr ;
4372
- }
4373
4367
4374
- if (derivedClass->getSuperclass ().isNull ()) {
4368
+ if (derivedClass->getSuperclass ().isNull ())
4375
4369
return nullptr ;
4376
- }
4377
4370
4378
- if (!derivedGenericCtx || !derivedGenericCtx->isGeneric ()) {
4371
+ if (baseGenericCtx->getGenericSignature ().isNull () ||
4372
+ derivedGenericCtx->getGenericSignature ().isNull ())
4379
4373
return nullptr ;
4380
- }
4381
-
4382
- if (derivedClass->getGenericSignature ().isNull () &&
4383
- !baseGenericCtx->isGeneric ()) {
4384
- return nullptr ;
4385
- }
4386
4374
4375
+ auto baseClassSig = baseClass->getGenericSignature ();
4387
4376
auto subMap = derivedClass->getSuperclass ()->getContextSubstitutionMap (
4388
4377
derivedClass->getModuleContext (), baseClass);
4389
4378
4390
- if (baseGenericCtx->getGenericSignature ().isNull ()) {
4391
- return nullptr ;
4392
- }
4393
4379
unsigned derivedDepth = 0 ;
4394
4380
4395
4381
auto key = OverrideSignatureKey (baseGenericCtx->getGenericSignature (),
@@ -4405,9 +4391,11 @@ ASTContext::getOverrideGenericSignature(const ValueDecl *base,
4405
4391
derivedDepth = derivedSig->getGenericParams ().back ()->getDepth () + 1 ;
4406
4392
4407
4393
SmallVector<GenericTypeParamType *, 2 > addedGenericParams;
4408
- for (auto gp : *derivedGenericCtx->getGenericParams ()) {
4409
- addedGenericParams.push_back (
4410
- gp->getDeclaredInterfaceType ()->castTo <GenericTypeParamType>());
4394
+ if (auto *gpList = derivedGenericCtx->getGenericParams ()) {
4395
+ for (auto gp : *gpList) {
4396
+ addedGenericParams.push_back (
4397
+ gp->getDeclaredInterfaceType ()->castTo <GenericTypeParamType>());
4398
+ }
4411
4399
}
4412
4400
4413
4401
unsigned baseDepth = 0 ;
0 commit comments