File tree Expand file tree Collapse file tree 2 files changed +27
-12
lines changed Expand file tree Collapse file tree 2 files changed +27
-12
lines changed Original file line number Diff line number Diff line change @@ -3457,21 +3457,18 @@ namespace {
34573457
34583458 argForIsolatedParam = arg;
34593459 unsatisfiedIsolation = std::nullopt ;
3460+
3461+ // Assume that a callee with an isolated parameter does not
3462+ // cross an isolation boundary. We'll set this again below if
3463+ // the given isolated argument doesn't match the isolation of the
3464+ // caller.
3465+ mayExitToNonisolated = false ;
3466+
3467+ // If the argument is an isolated parameter from the enclosing context,
3468+ // or #isolation, then the call does not cross an isolation boundary.
34603469 if (getIsolatedActor (arg) || isa<CurrentContextIsolationExpr>(arg))
34613470 continue ;
34623471
3463- // An isolated parameter was provided with a non-isolated argument.
3464- // FIXME: The modeling of unsatisfiedIsolation is not great here.
3465- // We'd be better off using something more like closure isolation
3466- // that can talk about specific parameters.
3467- auto nominal = getType (arg)->getAnyNominal ();
3468- if (!nominal) {
3469- // FIXME: This is wrong for distributed actors.
3470- nominal = getType (arg)->getASTContext ().getProtocol (
3471- KnownProtocolKind::Actor);
3472- }
3473-
3474- mayExitToNonisolated = false ;
34753472 auto calleeIsolation = ActorIsolation::forActorInstanceParameter (
34763473 const_cast <Expr *>(arg->findOriginalValue ()), paramIdx);
34773474
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-frontend -disable-availability-checking -swift-version 6 %s -emit-sil -o /dev/null -verify
2+
3+ public func doNotCross(
4+ isolation: isolated ( any Actor ) ? = #isolation,
5+ _ block: ( ) async -> Void
6+ ) async {
7+ await block ( )
8+ }
9+
10+ actor MyActor {
11+ func doStuff( ) { }
12+
13+ func test( ) async {
14+ await doNotCross {
15+ doStuff ( )
16+ }
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments