@@ -2427,9 +2427,17 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
2427
2427
CS.getConstraintLocator (locator, ConstraintLocator::ThrownErrorType),
2428
2428
0 , preparedOverload);
2429
2429
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
+
2430
2437
auto bodyClosure = FunctionType::get (arg, result,
2431
2438
FunctionType::ExtInfoBuilder ()
2432
2439
.withNoEscape (true )
2440
+ .withIsolation (bodyParamIsolation)
2433
2441
.withAsync (true )
2434
2442
.withThrows (true , thrownError)
2435
2443
.build ());
@@ -2438,9 +2446,16 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
2438
2446
FunctionType::Param (bodyClosure, CS.getASTContext ().getIdentifier (" do" )),
2439
2447
};
2440
2448
2449
+ auto withoutEscapingIsolation = FunctionTypeIsolation::forNonIsolated ();
2450
+ if (CS.getASTContext ().LangOpts .hasFeature (
2451
+ Feature::NonisolatedNonsendingByDefault)) {
2452
+ withoutEscapingIsolation = FunctionTypeIsolation::forNonIsolatedCaller ();
2453
+ }
2454
+
2441
2455
auto refType = FunctionType::get (args, result,
2442
2456
FunctionType::ExtInfoBuilder ()
2443
2457
.withNoEscape (false )
2458
+ .withIsolation (withoutEscapingIsolation)
2444
2459
.withAsync (true )
2445
2460
.withThrows (true , thrownError)
2446
2461
.build ());
@@ -2465,20 +2480,36 @@ static DeclReferenceType getTypeOfReferenceWithSpecialTypeCheckingSemantics(
2465
2480
CS.getConstraintLocator (locator, ConstraintLocator::ThrownErrorType),
2466
2481
0 , preparedOverload);
2467
2482
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
+
2468
2490
auto bodyClosure = FunctionType::get (bodyArgs, result,
2469
2491
FunctionType::ExtInfoBuilder ()
2470
2492
.withNoEscape (true )
2471
2493
.withThrows (true , thrownError)
2494
+ .withIsolation (bodyParamIsolation)
2472
2495
.withAsync (true )
2473
2496
.build ());
2474
2497
FunctionType::Param args[] = {
2475
2498
FunctionType::Param (existentialTy),
2476
2499
FunctionType::Param (bodyClosure, CS.getASTContext ().getIdentifier (" do" )),
2477
2500
};
2501
+
2502
+ auto openExistentialIsolation = FunctionTypeIsolation::forNonIsolated ();
2503
+ if (CS.getASTContext ().LangOpts .hasFeature (
2504
+ Feature::NonisolatedNonsendingByDefault)) {
2505
+ openExistentialIsolation = FunctionTypeIsolation::forNonIsolatedCaller ();
2506
+ }
2507
+
2478
2508
auto refType = FunctionType::get (args, result,
2479
2509
FunctionType::ExtInfoBuilder ()
2480
2510
.withNoEscape (false )
2481
2511
.withThrows (true , thrownError)
2512
+ .withIsolation (openExistentialIsolation)
2482
2513
.withAsync (true )
2483
2514
.build ());
2484
2515
return {refType, refType, refType, refType, Type ()};
0 commit comments