Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0192-rdar39826863.swift
Slava Pestov 0f53290cb2 Add regression test for fixed bugs
<rdar://problem/39826863>, and <https://bugs.swift.org/browse/SR-9508>.
2019-04-02 19:00:01 -04:00

35 lines
781 B
Swift

// RUN: %target-swift-frontend -typecheck %s
protocol Tuple {
associatedtype Head
associatedtype Tail : Tuple
}
extension Pair : Tuple where Second : Tuple {
typealias Head = First
typealias Tail = Second
}
protocol HomogeneousTuple : Tuple, Collection
where Tail : HomogeneousTuple, Head == Tail.Head {}
extension HomogeneousTuple {
typealias Element = Head
typealias Index = Int
var startIndex: Int { return 0 }
var endIndex: Int { return 0 }
func index(after i: Int) -> Int { return i + 1 }
subscript(n: Int) -> Head {
fatalError()
}
}
extension Pair : Sequence, Collection, HomogeneousTuple
where Second : HomogeneousTuple, First == Second.Head {
typealias Iterator = IndexingIterator<Pair<Head, Tail>>
}
struct Pair<First, Second> {}