@@ -2322,9 +2322,17 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
23222322 CS.getConstraintLocator (locator, ConstraintLocator::ThrownErrorType),
23232323 0 );
23242324 FunctionType::Param arg (escapeClosure);
2325+
2326+ auto bodyParamIsolation = FunctionTypeIsolation::forNonIsolated ();
2327+ if (CS.getASTContext ().LangOpts .hasFeature (
2328+ Feature::NonisolatedNonsendingByDefault)) {
2329+ bodyParamIsolation = FunctionTypeIsolation::forNonIsolatedCaller ();
2330+ }
2331+
23252332 auto bodyClosure = FunctionType::get (arg, result,
23262333 FunctionType::ExtInfoBuilder ()
23272334 .withNoEscape (true )
2335+ .withIsolation (bodyParamIsolation)
23282336 .withAsync (true )
23292337 .withThrows (true , thrownError)
23302338 .build ());
@@ -2333,9 +2341,16 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
23332341 FunctionType::Param (bodyClosure, CS.getASTContext ().getIdentifier (" do" )),
23342342 };
23352343
2344+ auto withoutEscapingIsolation = FunctionTypeIsolation::forNonIsolated ();
2345+ if (CS.getASTContext ().LangOpts .hasFeature (
2346+ Feature::NonisolatedNonsendingByDefault)) {
2347+ withoutEscapingIsolation = FunctionTypeIsolation::forNonIsolatedCaller ();
2348+ }
2349+
23362350 auto refType = FunctionType::get (args, result,
23372351 FunctionType::ExtInfoBuilder ()
23382352 .withNoEscape (false )
2353+ .withIsolation (withoutEscapingIsolation)
23392354 .withAsync (true )
23402355 .withThrows (true , thrownError)
23412356 .build ());
@@ -2359,20 +2374,36 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
23592374 CS.getConstraintLocator (locator, ConstraintLocator::ThrownErrorType),
23602375 0 );
23612376 FunctionType::Param bodyArgs[] = {FunctionType::Param (openedTy)};
2377+
2378+ auto bodyParamIsolation = FunctionTypeIsolation::forNonIsolated ();
2379+ if (CS.getASTContext ().LangOpts .hasFeature (
2380+ Feature::NonisolatedNonsendingByDefault)) {
2381+ bodyParamIsolation = FunctionTypeIsolation::forNonIsolatedCaller ();
2382+ }
2383+
23622384 auto bodyClosure = FunctionType::get (bodyArgs, result,
23632385 FunctionType::ExtInfoBuilder ()
23642386 .withNoEscape (true )
23652387 .withThrows (true , thrownError)
2388+ .withIsolation (bodyParamIsolation)
23662389 .withAsync (true )
23672390 .build ());
23682391 FunctionType::Param args[] = {
23692392 FunctionType::Param (existentialTy),
23702393 FunctionType::Param (bodyClosure, CS.getASTContext ().getIdentifier (" do" )),
23712394 };
2395+
2396+ auto openExistentialIsolation = FunctionTypeIsolation::forNonIsolated ();
2397+ if (CS.getASTContext ().LangOpts .hasFeature (
2398+ Feature::NonisolatedNonsendingByDefault)) {
2399+ openExistentialIsolation = FunctionTypeIsolation::forNonIsolatedCaller ();
2400+ }
2401+
23722402 auto refType = FunctionType::get (args, result,
23732403 FunctionType::ExtInfoBuilder ()
23742404 .withNoEscape (false )
23752405 .withThrows (true , thrownError)
2406+ .withIsolation (openExistentialIsolation)
23762407 .withAsync (true )
23772408 .build ());
23782409 return {refType, refType, refType, refType, Type ()};
0 commit comments