File tree Expand file tree Collapse file tree 2 files changed +57
-1
lines changed
validation-test/compiler_crashers_2_fixed Expand file tree Collapse file tree 2 files changed +57
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,9 @@ class SILTypeSubstituter :
77
77
ProtocolConformanceRef (conformedProtocol),
78
78
conformingReplacementType->getCanonicalType (),
79
79
typeExpansionContext);
80
- }, SubstFlags::SubstituteOpaqueArchetypes);
80
+ },
81
+ SubstFlags::SubstituteOpaqueArchetypes |
82
+ SubstFlags::PreservePackExpansionLevel);
81
83
}
82
84
83
85
// Substitute a function type.
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -emit-ir %s -disable-availability-checking
2
+
3
+ struct ZipCollection < each C : Collection > {
4
+ let c : ( repeat each C )
5
+ }
6
+
7
+ extension ZipCollection : Collection {
8
+ struct Element {
9
+ var elt : ( repeat each C . Element )
10
+ }
11
+
12
+ struct Index {
13
+ let i : ( repeat each C . Index )
14
+ }
15
+
16
+ var startIndex : Index {
17
+ Index ( i: ( repeat ( each c) . startIndex) )
18
+ }
19
+
20
+ var endIndex : Index {
21
+ Index ( i: ( repeat ( each c) . endIndex) )
22
+ }
23
+
24
+ func index( after i: Index ) -> Index {
25
+ Index ( i: ( repeat ( each c) . index ( after: each i. i) ) )
26
+ }
27
+
28
+ subscript( index: Index ) -> Element {
29
+ Element ( elt: ( repeat ( each c) [ each index. i] ) )
30
+ }
31
+ }
32
+
33
+ extension ZipCollection . Index : Equatable {
34
+ static func == ( lhs: Self , rhs: Self ) -> Bool {
35
+ var result = true
36
+ repeat result = ( ( each lhs. i) == ( each rhs. i) ) && result
37
+ return result
38
+ }
39
+ }
40
+
41
+ extension ZipCollection . Index : Comparable {
42
+ static func < ( lhs: Self , rhs: Self ) -> Bool {
43
+ var result : Bool ? = nil
44
+ func check< T: Comparable > ( _ x: T , _ y: T ) {
45
+ if result == nil {
46
+ if x == y { return }
47
+ if x < y { result = true }
48
+ if x > y { result = false }
49
+ }
50
+ }
51
+ repeat check( each lhs. i, each rhs. i)
52
+ return result ?? false
53
+ }
54
+ }
You can’t perform that action at this time.
0 commit comments