File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -3344,6 +3344,13 @@ ActorIsolation ActorIsolationRequest::evaluate(
3344
3344
return inferredIsolation (isolation);
3345
3345
}
3346
3346
3347
+ // If this is a dynamic replacement for another function, use the
3348
+ // actor isolation of the function it replaces.
3349
+ if (auto replacedDecl = value->getDynamicallyReplacedDecl ()) {
3350
+ if (auto isolation = getActorIsolation (replacedDecl))
3351
+ return inferredIsolation (isolation);
3352
+ }
3353
+
3347
3354
if (shouldInferAttributeInContext (value->getDeclContext ())) {
3348
3355
// If the declaration witnesses a protocol requirement that is isolated,
3349
3356
// use that.
Original file line number Diff line number Diff line change 1
- // RUN: %target-typecheck-verify-swift -disable-availability-checking
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-swift-frontend -emit-module -emit-module-path %t/dynamically_replaceable.swiftmodule -module-name dynamically_replaceable -warn-concurrency %S/Inputs/dynamically_replaceable.swift
3
+ // RUN: %target-typecheck-verify-swift -I %t -disable-availability-checking
2
4
// REQUIRES: concurrency
5
+ import dynamically_replaceable
3
6
4
7
actor SomeActor { }
5
8
@@ -552,3 +555,11 @@ func useFooInADefer() -> String {
552
555
553
556
return " hello "
554
557
}
558
+
559
+ // ----------------------------------------------------------------------
560
+ // Dynamic replacement
561
+ // ----------------------------------------------------------------------
562
+ @_dynamicReplacement ( for: dynamicOnMainActor)
563
+ func replacesDynamicOnMainActor( ) {
564
+ onlyOnMainActor ( )
565
+ }
You can’t perform that action at this time.
0 commit comments