Open
Description
Description
_Concurrency.AsyncSequence
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
extension AsyncSequence {
@preconcurrency @inlinable public func prefix(while predicate: @escaping @Sendable (Self.Element) async -> Bool) rethrows -> AsyncPrefixWhileSequence<Self>
}
This causes the compiler to require writing try
when one of the inner closures owned by a different method is a throwing closure, even if the closure owned by prefix()
is non-throwing
Reproduction
AsyncThrowingStream( // Call can throw but is not marked with 'try'
// Call is to 'rethrows' function, but a conformance has a throwing witness
unfolding: {
try await Task.sleep(for: .zero)
}
)
.prefix(while: { _ in true })
Expected behavior
Should not have a compiler error requiring the use of try
Environment
Swift 6.0
Additional information
No response