File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments