mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
In a couple of cases, we weren't properly extracting the correct archetype type from generic type parameters. This was causing various crashes and strange errors throughout the system. (See rdar://problem/16296421, rdar://problem/16273217, rdar://problem/16329242) Swift SVN r15213
31 lines
639 B
Swift
31 lines
639 B
Swift
// RUN: %swift -parse -verify %s
|
|
|
|
struct S<A: Collection where A.IndexType == Int> : Collection {
|
|
typealias Element = A.GeneratorType.Element
|
|
typealias IndexType = A.IndexType
|
|
|
|
init(base: A, baseRange: Range<IndexType>) {
|
|
self.base = base
|
|
self.baseRange = baseRange
|
|
}
|
|
|
|
var startIndex: IndexType {
|
|
return .from(0)
|
|
}
|
|
|
|
var endIndex: IndexType {
|
|
return Swift.count(baseRange)
|
|
}
|
|
|
|
subscript(i: IndexType) -> Element {
|
|
return base[baseRange.startIndex + i]
|
|
}
|
|
|
|
func generate() -> IndexingGenerator<S> {
|
|
return IndexingGenerator(self)
|
|
}
|
|
|
|
var base: A
|
|
var baseRange: Range<A.IndexType>
|
|
}
|