mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Renamed type witnesses for the Async(Sequence|IteratorProtocol) Failure type
The type aliases for inferred type witnesses to the AsyncSequence and AsyncIteratorProtocol's Failure associated type are getting in the way of existing types with the same name. Therefore, when we create these type aliases, given them weird names (e.g., `__AsyncSequence.Failure`) and wire them up with `@_implements(<protocol>, Failure)` so that associated type inference will find them. This is probably a model we should move to in general, because it's odd that we inject new declarations into types that could cause conflicts. However, start by staging it in for just this one associated type where we have source-compatibility concerns, and we can expand it over time. Fixes rdar://124362873.
This commit is contained in:
@@ -12,7 +12,8 @@ public struct SequenceAdapter<Base: AsyncSequence>: AsyncSequence {
|
||||
// CHECK: @available{{.*}}macOS 10.15
|
||||
// CHECK-NEXT: public typealias Element = Base.Element
|
||||
// CHECK: @available(
|
||||
// CHECK-NEXT: public typealias Failure = Base.Failure
|
||||
// CHECK: @_implements(_Concurrency.AsyncIteratorProtocol, Failure)
|
||||
// CHECK-SAME: public typealias __AsyncIteratorProtocol_Failure = Base.Failure
|
||||
public typealias Element = Base.Element
|
||||
|
||||
public struct AsyncIterator: AsyncIteratorProtocol {
|
||||
@@ -23,7 +24,8 @@ public struct SequenceAdapter<Base: AsyncSequence>: AsyncSequence {
|
||||
public func makeAsyncIterator() -> AsyncIterator { AsyncIterator() }
|
||||
|
||||
// CHECK: @available(
|
||||
// CHECK-NEXT: public typealias Failure = Base.Failure
|
||||
// CHECK: @_implements(_Concurrency.AsyncSequence, Failure)
|
||||
// CHECK-SAME: public typealias __AsyncSequence_Failure = Base.Failure
|
||||
}
|
||||
|
||||
// CHECK: @available(
|
||||
@@ -37,7 +39,8 @@ public struct OtherSequenceAdapter<Base: AsyncSequence>: AsyncSequence {
|
||||
// CHECK-LABEL: public struct AsyncIterator
|
||||
// CHECK: @available{{.*}}macOS 10.15
|
||||
// CHECK: @available(
|
||||
// CHECK-NEXT: public typealias Failure = Base.Failure
|
||||
// CHECK: @_implements(_Concurrency.AsyncIteratorProtocol, Failure)
|
||||
// CHECK-SAME: public typealias __AsyncIteratorProtocol_Failure = Base.Failure
|
||||
public typealias Element = Base.Element
|
||||
|
||||
public struct Failure: Error { }
|
||||
|
||||
Reference in New Issue
Block a user