mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
28 lines
698 B
Swift
28 lines
698 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
func f<T: Sequence>(_: T) -> T.Element {}
|
|
|
|
let x: Int = f(CustomCollection<Int>())
|
|
|
|
struct CustomCollection<Element>: RandomAccessCollection, MutableCollection {
|
|
typealias SubSequence = ArraySlice<Element>
|
|
typealias Index = Int
|
|
typealias Indices = Range<Int>
|
|
|
|
var startIndex: Int { fatalError() }
|
|
var endIndex: Int { fatalError() }
|
|
var first: Element? { fatalError() }
|
|
var last: Element? { fatalError() }
|
|
|
|
subscript(position: Index) -> Element {
|
|
get { fatalError() }
|
|
set { fatalError() }
|
|
}
|
|
|
|
subscript(bounds: Indices) -> SubSequence {
|
|
get { fatalError() }
|
|
set { fatalError() }
|
|
}
|
|
}
|
|
|