forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Concurrency] Calls that pass an isolated parameter matching the isol…
…ation of the context do not exit to nonisolated. Setting the `mayExitToNonisolated` during isolated parameter checking was done after a check that bails out early when the isolated argument matches the isolated paramter of the caller, so the actor isolation checker was accidentally considering the call as exiting to a nonisolated context. This lead to bogus diagnostics during the region isolation pass.
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RUN: %target-swift-frontend -disable-availability-checking -swift-version 6 %s -emit-sil -o /dev/null -verify | ||
|
||
public func doNotCross( | ||
isolation: isolated (any Actor)? = #isolation, | ||
_ block: () async -> Void | ||
) async { | ||
await block() | ||
} | ||
|
||
actor MyActor { | ||
func doStuff() {} | ||
|
||
func test() async { | ||
await doNotCross { | ||
doStuff() | ||
} | ||
} | ||
} |