File tree Expand file tree Collapse file tree 3 files changed +17
-16
lines changed Expand file tree Collapse file tree 3 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -468,18 +468,6 @@ internal enum _SubSequenceSubscriptOnRangeMode {
468
468
}
469
469
}
470
470
471
- internal func _product<C1 : Collection, C2 : Collection>(
472
- _ c1: C1, _ c2: C2
473
- ) -> [(C1.Iterator.Element, C2.Iterator.Element)] {
474
- var result: [(C1.Iterator.Element, C2.Iterator.Element)] = []
475
- for e1 in c1 {
476
- for e2 in c2 {
477
- result.append((e1, e2))
478
- }
479
- }
480
- return result
481
- }
482
-
483
471
%{
484
472
from gyb_stdlib_support import collectionForTraversal
485
473
def testConstraints(protocol):
@@ -623,7 +611,7 @@ extension TestSuite {
623
611
_blackHole(c[index])
624
612
}
625
613
626
- let tests = _product (
614
+ let tests = cartesianProduct (
627
615
subscriptRangeTests,
628
616
_SubSequenceSubscriptOnIndexMode.all)
629
617
@@ -722,7 +710,7 @@ extension TestSuite {
722
710
_blackHole(c[index..<index])
723
711
}
724
712
725
- let tests = _product (
713
+ let tests = cartesianProduct (
726
714
subscriptRangeTests,
727
715
_SubSequenceSubscriptOnRangeMode.all)
728
716
Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ if resiliencyChecks.subscriptOnOutOfBoundsIndicesBehavior != .none {
172
172
c[index] = wrapValue(OpaqueValue(9999))
173
173
}
174
174
175
- let tests = _product (
175
+ let tests = cartesianProduct (
176
176
subscriptRangeTests,
177
177
_SubSequenceSubscriptOnIndexMode.all)
178
178
@@ -325,7 +325,7 @@ if isFixedLengthCollection {
325
325
}
326
326
327
327
if resiliencyChecks.subscriptRangeOnOutOfBoundsRangesBehavior != .none {
328
- let tests = _product (
328
+ let tests = cartesianProduct (
329
329
subscriptRangeTests,
330
330
_SubSequenceSubscriptOnRangeMode.all)
331
331
Original file line number Diff line number Diff line change @@ -232,3 +232,16 @@ public func forAllPermutations<S : Sequence>(
232
232
return ( )
233
233
}
234
234
}
235
+
236
+ public func cartesianProduct< C1 : Collection , C2 : Collection > (
237
+ _ c1: C1 , _ c2: C2
238
+ ) -> [ ( C1 . Iterator . Element , C2 . Iterator . Element ) ] {
239
+ var result : [ ( C1 . Iterator . Element , C2 . Iterator . Element ) ] = [ ]
240
+ for e1 in c1 {
241
+ for e2 in c2 {
242
+ result. append ( ( e1, e2) )
243
+ }
244
+ }
245
+ return result
246
+ }
247
+
You can’t perform that action at this time.
0 commit comments