Skip to content

Commit d30c107

Browse files
committed
Add test case for rdar://124697829
This was fixed by 6cd5468.
1 parent 3bd53a6 commit d30c107

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

test/Generics/rdar124697829.swift

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+

0 commit comments

Comments
 (0)