 let initialCallCounts = [
   "successor": 0, "predecessor": 0,
   "_successorInPlace": 0, "_predecessorInPlace": 0,
-  "advanced(by:)": 0, "distance(to:)": 0
+  "advance(_:by:)": 0, "distance(from:to:)": 0
 ]
 
 var callCounts = initialCallCounts
-  
-struct InstrumentedIndex<I : RandomAccessIndex> : RandomAccessIndex {
-  typealias Distance = I.Distance
-
-  var base: I
-  
-  init(_ base: I) {
+
+struct InstrumentedCollection<
+  C : RandomAccessCollection
+> : RandomAccessCollection {
+
+  typealias Index = C.Index
+  typealias Iterator = C.Iterator
+  typealias IndexDistance = C.IndexDistance
+
+  typealias SubSequence = C.SubSequence
+  typealias Indices = C.Indices
+
+  var base: C
+
+  init(_ base: C) {
     self.base = base
   }
-  
+
   static func resetCounts() {
     callCounts = initialCallCounts
   }
-  
-  func successor() -> InstrumentedIndex {
+
+  @warn_unused_result
+  func next(i: Index) -> Index {
     callCounts["successor"]! += 1
-    return InstrumentedIndex(base.successor())
-  }
-  
-  mutating func _successorInPlace() {
+    return base.next(i)
+  }
+
+  func _nextInPlace(i: inout Index) {
     callCounts["_successorInPlace"]! += 1
-    base._successorInPlace()
-  }
-  
-  func predecessor() -> InstrumentedIndex {
+    base._nextInPlace(&i)
+  }
+
+  @warn_unused_result
+  func previous(i: Index) -> Index {
     callCounts["predecessor"]! += 1
-    return InstrumentedIndex(base.predecessor())
-  }
-  
-  mutating func _predecessorInPlace() {
+    return base.previous(i)
+  }
+
+  func _previousInPlace(i: inout Index) {
     callCounts["_predecessorInPlace"]! += 1
-    base._predecessorInPlace()
-  }
-  
-  func advanced(by distance: Distance) -> InstrumentedIndex {
-    callCounts["advanced(by:)"]! += 1
-    return InstrumentedIndex(base.advanced(by: distance))
-  }
-  
-  func distance(to other: InstrumentedIndex) -> Distance {
-    callCounts["distance(to:)"]! += 1
-    return base.distance(to: other.base)
-  }
+    base._previousInPlace(&i)
+  }
+
+  func advance(i: Index, by n: IndexDistance) -> Index {
+    callCounts["advance(_:by:)"]! += 1
+    return base.advance(i, by: n)
+  }
+
+  func distance(from start: Index, to end: Index) -> IndexDistance {
+    callCounts["distance(from:to:)"]! += 1
+    return base.distance(from: start, to: end)
+  }
+
+  var startIndex: Index {
+    return base.startIndex
+  }
+
+  var endIndex: Index {
+    return base.endIndex
+  }
+
+  subscript(i: Index) -> Iterator.Element {
+    fatalError()
+  }
+
+  subscript(bounds: Range<Index>) -> SubSequence {
+    fatalError()
+  }
+
+  func makeIterator() -> Iterator {
+    return base.makeIterator()
+  }
+
+  var indices: Indices {
+    return base.indices
+  }
+
 }
 
 tests.test("AnySequence.init(Sequence)") {


tests.test("RandomAccessCollection") {
  let a0: ContiguousArray = [1, 2, 3, 5, 8, 13, 21]
  let fc0 = AnyForwardCollection(a0.lazy.reversed())
  let rc0_ = AnyRandomAccessCollection(fc0)         // upgrade!
  expectNotEmpty(rc0_)
  let rc0 = rc0_!

    
    // This is a really complicated type of no interest to our
    // clients.
    let iterator: LazyMapIterator<
        IndexingIterator<RangeOfStrideable<Int>>, String
      > = lazyStrings.makeIterator()
    return AnyIterator(iterator)
  }
  expectEqual(["0", "1", "2", "3", "4"], Array(digits()))
