Did you build with -enable-experimental-feature OptionalIsolatedParameters? I tried to build this with -enable-experimental-feature OptionalIsolatedParameters -strict-concurrency=complete on main and I do not see any concurrency warnings:
class NotSendable {}
@MainActor
class ActorIsolatedType {
func foo() async {
await (1...3).forEachAsync(MainActor.shared) { _ in
await bar(NotSendable())
}
}
func bar(_: NotSendable) async {}
}
extension Sequence where Element: Sendable {
func forEachAsync(_: isolated Actor, _ operation: (Element) async -> Void) async {
for element in self {
await operation(element)
}
}
}