Skip to content

Commit 487f6d9

Browse files
committed
1 parent 18af945 commit 487f6d9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: not %target-swift-frontend -typecheck %s
2+
3+
struct CountSteps1<T> : Collection {
4+
init(count: Int) { self.count = count }
5+
var count: Int
6+
7+
var startIndex: Int { 0 }
8+
var endIndex: Int { count }
9+
func index(after i: Int) -> Int {
10+
totalSteps += 1
11+
return i + 1
12+
}
13+
subscript(i: Int) -> Int { return i }
14+
}
15+
16+
extension CountSteps1
17+
: RandomAccessCollection, BidirectionalCollection
18+
where T : Equatable
19+
{
20+
func index(_ i: Index, offsetBy d: Int) -> Index {
21+
return i + d
22+
}
23+
}

0 commit comments

Comments
 (0)