@@ -2427,9 +2427,17 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
24272427 CS.getConstraintLocator (locator, ConstraintLocator::ThrownErrorType),
24282428 0 , preparedOverload);
24292429 FunctionType::Param arg (escapeClosure);
2430+
2431+ auto bodyParamIsolation = FunctionTypeIsolation::forNonIsolated ();
2432+ if (CS.getASTContext ().LangOpts .hasFeature (
2433+ Feature::NonisolatedNonsendingByDefault)) {
2434+ bodyParamIsolation = FunctionTypeIsolation::forNonIsolatedCaller ();
2435+ }
2436+
24302437 auto bodyClosure = FunctionType::get (arg, result,
24312438 FunctionType::ExtInfoBuilder ()
24322439 .withNoEscape (true )
2440+ .withIsolation (bodyParamIsolation)
24332441 .withAsync (true )
24342442 .withThrows (true , thrownError)
24352443 .build ());
@@ -2438,9 +2446,16 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
24382446 FunctionType::Param (bodyClosure, CS.getASTContext ().getIdentifier (" do" )),
24392447 };
24402448
2449+ auto withoutEscapingIsolation = FunctionTypeIsolation::forNonIsolated ();
2450+ if (CS.getASTContext ().LangOpts .hasFeature (
2451+ Feature::NonisolatedNonsendingByDefault)) {
2452+ withoutEscapingIsolation = FunctionTypeIsolation::forNonIsolatedCaller ();
2453+ }
2454+
24412455 auto refType = FunctionType::get (args, result,
24422456 FunctionType::ExtInfoBuilder ()
24432457 .withNoEscape (false )
2458+ .withIsolation (withoutEscapingIsolation)
24442459 .withAsync (true )
24452460 .withThrows (true , thrownError)
24462461 .build ());
@@ -2465,20 +2480,36 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
24652480 CS.getConstraintLocator (locator, ConstraintLocator::ThrownErrorType),
24662481 0 , preparedOverload);
24672482 FunctionType::Param bodyArgs[] = {FunctionType::Param (openedTy)};
2483+
2484+ auto bodyParamIsolation = FunctionTypeIsolation::forNonIsolated ();
2485+ if (CS.getASTContext ().LangOpts .hasFeature (
2486+ Feature::NonisolatedNonsendingByDefault)) {
2487+ bodyParamIsolation = FunctionTypeIsolation::forNonIsolatedCaller ();
2488+ }
2489+
24682490 auto bodyClosure = FunctionType::get (bodyArgs, result,
24692491 FunctionType::ExtInfoBuilder ()
24702492 .withNoEscape (true )
24712493 .withThrows (true , thrownError)
2494+ .withIsolation (bodyParamIsolation)
24722495 .withAsync (true )
24732496 .build ());
24742497 FunctionType::Param args[] = {
24752498 FunctionType::Param (existentialTy),
24762499 FunctionType::Param (bodyClosure, CS.getASTContext ().getIdentifier (" do" )),
24772500 };
2501+
2502+ auto openExistentialIsolation = FunctionTypeIsolation::forNonIsolated ();
2503+ if (CS.getASTContext ().LangOpts .hasFeature (
2504+ Feature::NonisolatedNonsendingByDefault)) {
2505+ openExistentialIsolation = FunctionTypeIsolation::forNonIsolatedCaller ();
2506+ }
2507+
24782508 auto refType = FunctionType::get (args, result,
24792509 FunctionType::ExtInfoBuilder ()
24802510 .withNoEscape (false )
24812511 .withThrows (true , thrownError)
2512+ .withIsolation (openExistentialIsolation)
24822513 .withAsync (true )
24832514 .build ());
24842515 return {refType, refType, refType, refType, Type ()};
0 commit comments