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 @@ -3463,21 +3463,18 @@ namespace {
34633463
34643464 argForIsolatedParam = arg;
34653465 unsatisfiedIsolation = std::nullopt ;
3466+
3467+ // Assume that a callee with an isolated parameter does not
3468+ // cross an isolation boundary. We'll set this again below if
3469+ // the given isolated argument doesn't match the isolation of the
3470+ // caller.
3471+ mayExitToNonisolated = false ;
3472+
3473+ // If the argument is an isolated parameter from the enclosing context,
3474+ // or #isolation, then the call does not cross an isolation boundary.
34663475 if (getIsolatedActor (arg) || isa<CurrentContextIsolationExpr>(arg))
34673476 continue ;
34683477
3469- // An isolated parameter was provided with a non-isolated argument.
3470- // FIXME: The modeling of unsatisfiedIsolation is not great here.
3471- // We'd be better off using something more like closure isolation
3472- // that can talk about specific parameters.
3473- auto nominal = getType (arg)->getAnyNominal ();
3474- if (!nominal) {
3475- // FIXME: This is wrong for distributed actors.
3476- nominal = getType (arg)->getASTContext ().getProtocol (
3477- KnownProtocolKind::Actor);
3478- }
3479-
3480- mayExitToNonisolated = false ;
34813478 auto calleeIsolation = ActorIsolation::forActorInstanceParameter (
34823479 const_cast <Expr *>(arg->findOriginalValue ()), paramIdx);
34833480
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