File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-frontend -emit-ir %s -disable-availability-checking
2+
3+ // This is a generics test, but only IRGen exercised the substitution of
4+ // an abstract conformance with a type parameter -- in the type checker and
5+ // SIL, we only deal with archetypes.
6+
7+ public protocol IteratorProtocol {
8+ associatedtype Element
9+ }
10+
11+ public protocol Sequence {
12+ associatedtype Iterator : IteratorProtocol
13+ associatedtype Element where Element == Iterator . Element
14+ }
15+
16+ public struct IndexingIterator < S: Sequence > : IteratorProtocol {
17+ public typealias Element = S . Element
18+ }
19+
20+ public struct Array < Element> : Sequence {
21+ public typealias Iterator = IndexingIterator < Self >
22+ }
23+
24+ public protocol Publisher {
25+ associatedtype Output
26+ }
27+
28+ public struct SequencePublisher < Elements: Sequence > : Publisher {
29+ public typealias Output = Elements . Element
30+ }
31+
32+ public struct Map < Pub: Publisher , Output> : Publisher { }
33+
34+ public func foo< T> ( _: T ) -> some Publisher {
35+ bar ( SequencePublisher < Array < T > > ( ) )
36+ }
37+
38+ public func bar< Pub: Publisher > ( _: Pub ) -> some Publisher {
39+ Map < Pub , Pub . Output > ( )
40+ }
41+
You can’t perform that action at this time.
0 commit comments