@@ -378,8 +378,9 @@ static bool doesAccessorNeedDynamicAttribute(AccessorDecl *accessor) {
378
378
CtorInitializerKind
379
379
InitKindRequest::evaluate (Evaluator &evaluator, ConstructorDecl *decl) const {
380
380
auto &diags = decl->getASTContext ().Diags ;
381
+ auto dc = decl->getDeclContext ();
381
382
382
- if (auto nominal = decl-> getDeclContext () ->getSelfNominalTypeDecl ()) {
383
+ if (auto nominal = dc ->getSelfNominalTypeDecl ()) {
383
384
384
385
// Convenience inits are only allowed on classes and in extensions thereof.
385
386
if (auto convenAttr = decl->getAttrs ().getAttribute <ConvenienceAttr>()) {
@@ -389,6 +390,7 @@ InitKindRequest::evaluate(Evaluator &evaluator, ConstructorDecl *decl) const {
389
390
diags.diagnose (decl->getLoc (),
390
391
diag::no_convenience_keyword_init, " actors" )
391
392
.fixItRemove (convenAttr->getLocation ())
393
+ .warnInSwiftInterface (dc)
392
394
.warnUntilSwiftVersion (6 );
393
395
394
396
} else { // not an actor
@@ -446,7 +448,7 @@ InitKindRequest::evaluate(Evaluator &evaluator, ConstructorDecl *decl) const {
446
448
// (or the same file) to add vtable entries, we can re-evaluate this
447
449
// restriction.
448
450
if (!decl->isSynthesized () &&
449
- isa<ExtensionDecl>(decl-> getDeclContext () ->getImplementedObjCContext ()) &&
451
+ isa<ExtensionDecl>(dc ->getImplementedObjCContext ()) &&
450
452
!(decl->getAttrs ().hasAttribute <DynamicReplacementAttr>())) {
451
453
452
454
if (classDcl->getForeignClassKind () == ClassDecl::ForeignKind::CFType) {
@@ -475,7 +477,7 @@ InitKindRequest::evaluate(Evaluator &evaluator, ConstructorDecl *decl) const {
475
477
} // end of Nominal context
476
478
477
479
// initializers in protocol extensions must be convenience inits
478
- if (decl-> getDeclContext () ->getExtendedProtocolDecl ()) {
480
+ if (dc ->getExtendedProtocolDecl ()) {
479
481
return CtorInitializerKind::Convenience;
480
482
}
481
483
0 commit comments