File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift -enable-experimental-associated-type-inference
2
+ // RUN: %target-typecheck-verify-swift -disable-experimental-associated-type-inference
3
+
4
+ struct CustomCollection < T> : RandomAccessCollection {
5
+ struct CustomIndices : RandomAccessCollection {
6
+ var count : Int { fatalError ( ) }
7
+
8
+ var startIndex : Int { fatalError ( ) }
9
+ var endIndex : Int { fatalError ( ) }
10
+
11
+ subscript( index: Int ) -> Int { fatalError ( ) }
12
+ }
13
+
14
+ var count : Int { fatalError ( ) }
15
+ var indices : CustomIndices { fatalError ( ) }
16
+ var startIndex : Int { fatalError ( ) }
17
+ var endIndex : Int { fatalError ( ) }
18
+ func index( before i: Int ) -> Int { fatalError ( ) }
19
+ func index( after i: Int ) -> Int { fatalError ( ) }
20
+ subscript( index: Int ) -> T { fatalError ( ) }
21
+ }
Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift -enable-experimental-associated-type-inference
2
+ // RUN: not %target-typecheck-verify-swift -disable-experimental-associated-type-inference
3
+
4
+ func f< T: Sequence > ( _: T ) -> T . Element { }
5
+
6
+ let x : Int = f ( CustomCollection < Int > ( ) )
7
+
8
+ struct CustomCollection < Element> : RandomAccessCollection , MutableCollection {
9
+ typealias SubSequence = ArraySlice < Element >
10
+ typealias Index = Int
11
+ typealias Indices = Range < Int >
12
+
13
+ var startIndex : Int { fatalError ( ) }
14
+ var endIndex : Int { fatalError ( ) }
15
+ var first : Element ? { fatalError ( ) }
16
+ var last : Element ? { fatalError ( ) }
17
+
18
+ subscript( position: Index ) -> Element {
19
+ get { fatalError ( ) }
20
+ set { fatalError ( ) }
21
+ }
22
+
23
+ subscript( bounds: Indices ) -> SubSequence {
24
+ get { fatalError ( ) }
25
+ set { fatalError ( ) }
26
+ }
27
+ }
28
+
You can’t perform that action at this time.
0 commit comments