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