Files
swift-mirror/test/Concurrency/isolated_parameter_valid.swift
Holly Borla 2804daff5b [Concurrency] Calls that pass an isolated parameter matching the isolation 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.
2024-06-19 14:51:01 -07:00

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()
}
}
}