@@ -2322,9 +2322,17 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
2322
2322
CS.getConstraintLocator (locator, ConstraintLocator::ThrownErrorType),
2323
2323
0 );
2324
2324
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
+
2325
2332
auto bodyClosure = FunctionType::get (arg, result,
2326
2333
FunctionType::ExtInfoBuilder ()
2327
2334
.withNoEscape (true )
2335
+ .withIsolation (bodyParamIsolation)
2328
2336
.withAsync (true )
2329
2337
.withThrows (true , thrownError)
2330
2338
.build ());
@@ -2333,9 +2341,16 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
2333
2341
FunctionType::Param (bodyClosure, CS.getASTContext ().getIdentifier (" do" )),
2334
2342
};
2335
2343
2344
+ auto withoutEscapingIsolation = FunctionTypeIsolation::forNonIsolated ();
2345
+ if (CS.getASTContext ().LangOpts .hasFeature (
2346
+ Feature::NonisolatedNonsendingByDefault)) {
2347
+ withoutEscapingIsolation = FunctionTypeIsolation::forNonIsolatedCaller ();
2348
+ }
2349
+
2336
2350
auto refType = FunctionType::get (args, result,
2337
2351
FunctionType::ExtInfoBuilder ()
2338
2352
.withNoEscape (false )
2353
+ .withIsolation (withoutEscapingIsolation)
2339
2354
.withAsync (true )
2340
2355
.withThrows (true , thrownError)
2341
2356
.build ());
@@ -2359,20 +2374,36 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
2359
2374
CS.getConstraintLocator (locator, ConstraintLocator::ThrownErrorType),
2360
2375
0 );
2361
2376
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
+
2362
2384
auto bodyClosure = FunctionType::get (bodyArgs, result,
2363
2385
FunctionType::ExtInfoBuilder ()
2364
2386
.withNoEscape (true )
2365
2387
.withThrows (true , thrownError)
2388
+ .withIsolation (bodyParamIsolation)
2366
2389
.withAsync (true )
2367
2390
.build ());
2368
2391
FunctionType::Param args[] = {
2369
2392
FunctionType::Param (existentialTy),
2370
2393
FunctionType::Param (bodyClosure, CS.getASTContext ().getIdentifier (" do" )),
2371
2394
};
2395
+
2396
+ auto openExistentialIsolation = FunctionTypeIsolation::forNonIsolated ();
2397
+ if (CS.getASTContext ().LangOpts .hasFeature (
2398
+ Feature::NonisolatedNonsendingByDefault)) {
2399
+ openExistentialIsolation = FunctionTypeIsolation::forNonIsolatedCaller ();
2400
+ }
2401
+
2372
2402
auto refType = FunctionType::get (args, result,
2373
2403
FunctionType::ExtInfoBuilder ()
2374
2404
.withNoEscape (false )
2375
2405
.withThrows (true , thrownError)
2406
+ .withIsolation (openExistentialIsolation)
2376
2407
.withAsync (true )
2377
2408
.build ());
2378
2409
return {refType, refType, refType, refType, Type ()};
0 commit comments