Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0192-rdar39826863.swift
2022-05-10 12:56:17 -04:00

35 lines
779 B
Swift

// RUN: %target-swift-frontend -emit-ir %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> {}