mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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.
19 lines
354 B
Swift
19 lines
354 B
Swift
// 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()
|
|
}
|
|
}
|
|
}
|