@@ -4195,11 +4195,11 @@ NeverNullType TypeResolver::resolveASTFunctionType(
41954195 }
41964196 }
41974197
4198- if ( auto executionAttr = claim<ExecutionTypeAttr>(attrs) ) {
4198+ auto checkExecutionBehaviorAttribute = [&](TypeAttribute *attr ) {
41994199 if (!repr->isAsync ()) {
4200- diagnoseInvalid (repr, executionAttr-> getAtLoc (),
4200+ diagnoseInvalid (repr, attr-> getAttrLoc (),
42014201 diag::execution_behavior_type_attr_only_on_async,
4202- executionAttr ->getAttrName ());
4202+ attr ->getAttrName ());
42034203 }
42044204
42054205 switch (isolation.getKind ()) {
@@ -4208,29 +4208,33 @@ NeverNullType TypeResolver::resolveASTFunctionType(
42084208
42094209 case FunctionTypeIsolation::Kind::GlobalActor:
42104210 diagnoseInvalid (
4211- repr, executionAttr-> getAtLoc (),
4211+ repr, attr-> getAttrLoc (),
42124212 diag::execution_behavior_type_attr_incompatible_with_global_isolation,
4213- executionAttr ->getAttrName (), isolation.getGlobalActorType ());
4213+ attr ->getAttrName (), isolation.getGlobalActorType ());
42144214 break ;
42154215
42164216 case FunctionTypeIsolation::Kind::Parameter:
42174217 diagnoseInvalid (
4218- repr, executionAttr-> getAtLoc (),
4218+ repr, attr-> getAttrLoc (),
42194219 diag::execution_behavior_type_attr_incompatible_with_isolated_param,
4220- executionAttr ->getAttrName ());
4220+ attr ->getAttrName ());
42214221 break ;
42224222
42234223 case FunctionTypeIsolation::Kind::Erased:
42244224 diagnoseInvalid (
4225- repr, executionAttr-> getAtLoc (),
4225+ repr, attr-> getAttrLoc (),
42264226 diag::execution_behavior_type_attr_incompatible_with_isolated_any,
4227- executionAttr ->getAttrName ());
4227+ attr ->getAttrName ());
42284228 break ;
42294229
42304230 case FunctionTypeIsolation::Kind::NonIsolatedCaller:
42314231 llvm_unreachable (" cannot happen because multiple @execution attributes "
42324232 " aren't allowed." );
42334233 }
4234+ };
4235+
4236+ if (auto executionAttr = claim<ExecutionTypeAttr>(attrs)) {
4237+ checkExecutionBehaviorAttribute (executionAttr);
42344238
42354239 if (!repr->isInvalid ()) {
42364240 switch (executionAttr->getBehavior ()) {
@@ -4242,6 +4246,10 @@ NeverNullType TypeResolver::resolveASTFunctionType(
42424246 break ;
42434247 }
42444248 }
4249+ } else if (auto concurrentAttr = claim<ConcurrentTypeAttr>(attrs)) {
4250+ checkExecutionBehaviorAttribute (concurrentAttr);
4251+ if (!repr->isInvalid ())
4252+ isolation = FunctionTypeIsolation::forNonIsolated ();
42454253 } else {
42464254 if (ctx.LangOpts .getFeatureState (Feature::AsyncCallerExecution)
42474255 .isEnabledForAdoption ()) {
0 commit comments