@@ -7299,6 +7299,18 @@ RValue RValueEmitter::visitCurrentContextIsolationExpr(
7299
7299
dyn_cast_or_null<AbstractFunctionDecl>(SGF.F .getDeclRef ().getDecl ());
7300
7300
if (afd) {
7301
7301
auto isolation = getActorIsolation (afd);
7302
+ auto ctor = dyn_cast_or_null<ConstructorDecl>(afd);
7303
+ if (ctor && ctor->isDesignatedInit () &&
7304
+ isolation == ActorIsolation::ActorInstance &&
7305
+ isolation.getActorInstance () == ctor->getImplicitSelfDecl ()) {
7306
+ // If we are in an actor initializer that is isolated to self, the
7307
+ // current isolation is flow-sensitive; use that instead of the
7308
+ // synthesized expression.
7309
+ auto isolationValue =
7310
+ SGF.emitFlowSensitiveSelfIsolation (E, isolation);
7311
+ return RValue (SGF, E, isolationValue);
7312
+ }
7313
+
7302
7314
if (isolation == ActorIsolation::CallerIsolationInheriting) {
7303
7315
auto *isolatedArg = SGF.F .maybeGetIsolatedArgument ();
7304
7316
assert (isolatedArg &&
@@ -7311,18 +7323,6 @@ RValue RValueEmitter::visitCurrentContextIsolationExpr(
7311
7323
}
7312
7324
return RValue (SGF, E, isolatedMV);
7313
7325
}
7314
-
7315
- auto ctor = dyn_cast_or_null<ConstructorDecl>(afd);
7316
- if (ctor && ctor->isDesignatedInit () &&
7317
- isolation == ActorIsolation::ActorInstance &&
7318
- isolation.getActorInstance () == ctor->getImplicitSelfDecl ()) {
7319
- // If we are in an actor initializer that is isolated to self, the
7320
- // current isolation is flow-sensitive; use that instead of the
7321
- // synthesized expression.
7322
- auto isolationValue =
7323
- SGF.emitFlowSensitiveSelfIsolation (E, isolation);
7324
- return RValue (SGF, E, isolationValue);
7325
- }
7326
7326
}
7327
7327
7328
7328
return visit (E->getActor (), C);
0 commit comments