Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0080-rdar30442622.swift
Ben Cohen ca6c6b1d36 [stdlib] Cleanup DefaultIndices, delete dead code (#13952)
* Remove a bunch of Default(Bidirectional|RandomAccess)Indices usage from stdlib and test

* Remove some DefaultRandomAccessIndices and IndexDistance usage from Foundation

* Remove no-longer-used internal type in Existentials.swift

* Get rid of indicesForTraversal
2018-01-15 13:48:08 -08:00

27 lines
994 B
Swift

// RUN: %target-swift-frontend -typecheck -primary-file %s
protocol AnyCodeUnits_ {
typealias Index = Int64
typealias Element = UInt32
var startIndex: Index { get }
var endIndex: Index { get }
func index(after: Index) -> Index
func index(before: Index) -> Index
func index(_ i: Index, offsetBy: Int64) -> Index
subscript(i: Index) -> Element { get }
subscript(r: Range<Index>) -> AnyCodeUnits { get }
}
struct AnyCodeUnits : RandomAccessCollection, AnyCodeUnits_ {
let me: AnyCodeUnits_
typealias Indices = DefaultIndices<AnyCodeUnits>
var startIndex: Int64 { return me.startIndex }
var endIndex: Int64 { return me.endIndex }
func index(after i: Index) -> Index { return me.index(after: i) }
func index(before i: Index) -> Index { return me.index(before: i) }
func index(_ i: Index, offsetBy: Int64) -> Index { return me.index(i, offsetBy: i) }
subscript(i: Index) -> Element { return me[i] }
subscript(r: Range<Index>) -> AnyCodeUnits { return me[r] }
}