Skip to content

Commit 7626ea5

Browse files
authored
Merge pull request #23749 from slavapestov/add-regression-tests
Add regression test for fixed bugs
2 parents dd95a63 + 0f53290 commit 7626ea5

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %target-swift-frontend -typecheck %s
2+
3+
protocol P {
4+
associatedtype A
5+
}
6+
7+
struct S1: P {
8+
typealias A = Int
9+
}
10+
11+
struct S2<G: P>: P {
12+
typealias A = G.A
13+
}
14+
15+
struct S3<G: P> {
16+
}
17+
18+
extension S3 where G == S2<S1> {
19+
typealias B = G.A
20+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// RUN: %target-swift-frontend -typecheck %s
2+
3+
protocol Tuple {
4+
associatedtype Head
5+
associatedtype Tail : Tuple
6+
}
7+
8+
extension Pair : Tuple where Second : Tuple {
9+
typealias Head = First
10+
typealias Tail = Second
11+
}
12+
13+
protocol HomogeneousTuple : Tuple, Collection
14+
where Tail : HomogeneousTuple, Head == Tail.Head {}
15+
16+
extension HomogeneousTuple {
17+
typealias Element = Head
18+
typealias Index = Int
19+
20+
var startIndex: Int { return 0 }
21+
var endIndex: Int { return 0 }
22+
func index(after i: Int) -> Int { return i + 1 }
23+
24+
subscript(n: Int) -> Head {
25+
fatalError()
26+
}
27+
}
28+
29+
extension Pair : Sequence, Collection, HomogeneousTuple
30+
where Second : HomogeneousTuple, First == Second.Head {
31+
typealias Iterator = IndexingIterator<Pair<Head, Tail>>
32+
}
33+
34+
struct Pair<First, Second> {}

0 commit comments

Comments
 (0)