Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0192-rdar39826863.swift
Slava Pestov 2441e688e4 Pass -requirement-machine-protocol-signatures=on in a few tests where the GSB got it wrong
These fail with -requirement-machine-protocol-signatures=verify because
the GSB produces incorrect output. Enable the requirement machine
unconditionally for these tests, bypassing verification.

A new file test/Generics/same_type_requirements_in_protocol.swift
contains reduced versions of all of the failures, with FileCheck
used to confirm the exact requirement signature output.
2021-12-14 02:17:51 -05:00

35 lines
823 B
Swift

// RUN: %target-swift-frontend -emit-ir %s -requirement-machine-protocol-signatures=on
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> {}