@@ -4201,11 +4201,11 @@ NeverNullType TypeResolver::resolveASTFunctionType(
4201
4201
}
4202
4202
}
4203
4203
4204
- if ( auto executionAttr = claim<ExecutionTypeAttr>(attrs) ) {
4204
+ auto checkExecutionBehaviorAttribute = [&](TypeAttribute *attr ) {
4205
4205
if (!repr->isAsync ()) {
4206
- diagnoseInvalid (repr, executionAttr-> getAtLoc (),
4206
+ diagnoseInvalid (repr, attr-> getAttrLoc (),
4207
4207
diag::execution_behavior_type_attr_only_on_async,
4208
- executionAttr ->getAttrName ());
4208
+ attr ->getAttrName ());
4209
4209
}
4210
4210
4211
4211
switch (isolation.getKind ()) {
@@ -4214,29 +4214,33 @@ NeverNullType TypeResolver::resolveASTFunctionType(
4214
4214
4215
4215
case FunctionTypeIsolation::Kind::GlobalActor:
4216
4216
diagnoseInvalid (
4217
- repr, executionAttr-> getAtLoc (),
4217
+ repr, attr-> getAttrLoc (),
4218
4218
diag::execution_behavior_type_attr_incompatible_with_global_isolation,
4219
- executionAttr ->getAttrName (), isolation.getGlobalActorType ());
4219
+ attr ->getAttrName (), isolation.getGlobalActorType ());
4220
4220
break ;
4221
4221
4222
4222
case FunctionTypeIsolation::Kind::Parameter:
4223
4223
diagnoseInvalid (
4224
- repr, executionAttr-> getAtLoc (),
4224
+ repr, attr-> getAttrLoc (),
4225
4225
diag::execution_behavior_type_attr_incompatible_with_isolated_param,
4226
- executionAttr ->getAttrName ());
4226
+ attr ->getAttrName ());
4227
4227
break ;
4228
4228
4229
4229
case FunctionTypeIsolation::Kind::Erased:
4230
4230
diagnoseInvalid (
4231
- repr, executionAttr-> getAtLoc (),
4231
+ repr, attr-> getAttrLoc (),
4232
4232
diag::execution_behavior_type_attr_incompatible_with_isolated_any,
4233
- executionAttr ->getAttrName ());
4233
+ attr ->getAttrName ());
4234
4234
break ;
4235
4235
4236
4236
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
4237
4237
llvm_unreachable (" cannot happen because multiple @execution attributes "
4238
4238
" aren't allowed." );
4239
4239
}
4240
+ };
4241
+
4242
+ if (auto executionAttr = claim<ExecutionTypeAttr>(attrs)) {
4243
+ checkExecutionBehaviorAttribute (executionAttr);
4240
4244
4241
4245
if (!repr->isInvalid ()) {
4242
4246
switch (executionAttr->getBehavior ()) {
@@ -4248,6 +4252,10 @@ NeverNullType TypeResolver::resolveASTFunctionType(
4248
4252
break ;
4249
4253
}
4250
4254
}
4255
+ } else if (auto concurrentAttr = claim<ConcurrentTypeAttr>(attrs)) {
4256
+ checkExecutionBehaviorAttribute (concurrentAttr);
4257
+ if (!repr->isInvalid ())
4258
+ isolation = FunctionTypeIsolation::forNonIsolated ();
4251
4259
} else {
4252
4260
if (ctx.LangOpts .getFeatureState (Feature::AsyncCallerExecution)
4253
4261
.isEnabledForAdoption ()) {
0 commit comments