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