Skip to content

Commit 31114f2

Browse files
committed
Add regression test for rdar://94848868
1 parent c1dc446 commit 31114f2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/Generics/rdar94848868.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
// This is too circular to work, but it shouldn't crash.
4+
5+
protocol MyCollectionProtocol: Collection where Iterator == MyCollectionIterator<Self> {}
6+
// expected-error@-1 {{circular reference}}
7+
8+
struct MyCollectionIterator<MyCollection: MyCollectionProtocol>: IteratorProtocol {
9+
// expected-note@-1 3{{through reference here}}
10+
mutating func next() -> MyCollection.Element? {
11+
// expected-note@-1 2{{through reference here}}
12+
return nil
13+
}
14+
}
15+
16+
struct MyCollection: MyCollectionProtocol {
17+
struct Element {}
18+
19+
var startIndex: Int { fatalError() }
20+
var endIndex: Int { fatalError() }
21+
22+
func index(after i: Int) -> Int { fatalError() }
23+
subscript(position: Int) -> Element { fatalError() }
24+
25+
public func makeIterator() -> MyCollectionIterator<Self> { fatalError() }
26+
}

0 commit comments

Comments
 (0)