Files
swift-mirror/validation-test/compiler_crashers_2_fixed/issue-55135.swift

26 lines
553 B
Swift

// RUN: not %target-swift-frontend -typecheck %s
// https://github.com/apple/swift/issues/55135
struct CountSteps1<T> : Collection {
init(count: Int) { self.count = count }
var count: Int
var startIndex: Int { 0 }
var endIndex: Int { count }
func index(after i: Int) -> Int {
totalSteps += 1
return i + 1
}
subscript(i: Int) -> Int { return i }
}
extension CountSteps1
: RandomAccessCollection, BidirectionalCollection
where T : Equatable
{
func index(_ i: Index, offsetBy d: Int) -> Index {
return i + d
}
}