@@ -4411,6 +4411,7 @@ static void checkGlobalActorAttr(
4411
4411
std::pair<CustomAttr *, NominalTypeDecl *> &globalActorAttr) {
4412
4412
auto isolatedAttr = decl->getAttrs ().getAttribute <IsolatedAttr>();
4413
4413
auto nonisolatedAttr = decl->getAttrs ().getAttribute <NonisolatedAttr>();
4414
+ auto executionAttr = decl->getAttrs ().getAttribute <ExecutionAttr>();
4414
4415
struct NameAndRange {
4415
4416
StringRef name;
4416
4417
SourceRange range;
@@ -4419,7 +4420,7 @@ static void checkGlobalActorAttr(
4419
4420
: name(_name), range(_range) {}
4420
4421
};
4421
4422
4422
- llvm::SmallVector<NameAndRange, 3 > attributes;
4423
+ llvm::SmallVector<NameAndRange, 4 > attributes;
4423
4424
4424
4425
attributes.push_back (NameAndRange (globalActorAttr.second ->getName ().str (),
4425
4426
globalActorAttr.first ->getRangeWithAt ()));
@@ -4432,6 +4433,11 @@ static void checkGlobalActorAttr(
4432
4433
attributes.push_back (NameAndRange (nonisolatedAttr->getAttrName (),
4433
4434
nonisolatedAttr->getRangeWithAt ()));
4434
4435
}
4436
+ if (executionAttr) {
4437
+ attributes.push_back (NameAndRange (executionAttr->getAttrName (),
4438
+ executionAttr->getRangeWithAt ()));
4439
+ }
4440
+
4435
4441
if (attributes.size () == 1 )
4436
4442
return ;
4437
4443
@@ -4442,9 +4448,10 @@ static void checkGlobalActorAttr(
4442
4448
.highlight (attributes[1 ].range )
4443
4449
.warnUntilSwiftVersion (6 )
4444
4450
.fixItRemove (attributes[1 ].range );
4451
+ return ;
4452
+ }
4445
4453
4446
- } else {
4447
- assert (attributes.size () == 3 );
4454
+ if (attributes.size () == 3 ) {
4448
4455
decl->diagnose (diag::actor_isolation_multiple_attr_3, decl,
4449
4456
attributes[0 ].name , attributes[1 ].name , attributes[2 ].name )
4450
4457
.highlight (attributes[0 ].range )
@@ -4453,7 +4460,21 @@ static void checkGlobalActorAttr(
4453
4460
.warnUntilSwiftVersion (6 )
4454
4461
.fixItRemove (attributes[1 ].range )
4455
4462
.fixItRemove (attributes[2 ].range );
4463
+ return ;
4456
4464
}
4465
+
4466
+ assert (attributes.size () == 4 );
4467
+ decl->diagnose (diag::actor_isolation_multiple_attr_4, decl,
4468
+ attributes[0 ].name , attributes[1 ].name , attributes[2 ].name ,
4469
+ attributes[3 ].name )
4470
+ .highlight (attributes[0 ].range )
4471
+ .highlight (attributes[1 ].range )
4472
+ .highlight (attributes[2 ].range )
4473
+ .highlight (attributes[3 ].range )
4474
+ .warnUntilSwiftVersion (6 )
4475
+ .fixItRemove (attributes[1 ].range )
4476
+ .fixItRemove (attributes[2 ].range )
4477
+ .fixItRemove (attributes[3 ].range );
4457
4478
}
4458
4479
4459
4480
void AttributeChecker::visitCustomAttr (CustomAttr *attr) {
0 commit comments