Skip to content

Commit c71593a

Browse files
Dave AbrahamsAlexis Beingessner
authored andcommitted
Modernize some test code
1 parent 53fa261 commit c71593a

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

validation-test/stdlib/NewArray.swift.gyb

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,16 @@ protocol MyArrayProtocol
3838
: RandomAccessCollection,
3939
RangeReplaceableCollection,
4040
MutableCollection,
41-
ArrayLiteralConvertible {
41+
ExpressibleByArrayLiteral {
4242

4343
associatedtype Iterator : IteratorProtocol
4444

4545
var _owner: AnyObject? { get }
4646

4747
var capacity: Int { get }
4848

49-
func += <
50-
S : Sequence
51-
where
52-
S.Iterator.Element == Iterator.Element
53-
>(lhs: inout Self, rhs: S)
49+
static func += <S : Sequence>(lhs: inout Self, rhs: S)
50+
where S.Iterator.Element == Iterator.Element
5451
}
5552
extension MyArrayProtocol {
5653
var _bufferID: _BufferID {
@@ -72,26 +69,27 @@ func checkReallocation<T : MyArrayProtocol>(
7269
return currentBuffer
7370
}
7471

75-
func checkEqual<
76-
S1 : Sequence, S2 : Sequence
72+
func checkEqual<S1 : Sequence, S2 : Sequence>(
73+
_ a1: S1, _ a2: S2, _ expected: Bool
74+
)
7775
where
7876
S1.Iterator.Element == S2.Iterator.Element,
79-
S1.Iterator.Element : Equatable
80-
>(_ a1: S1, _ a2: S2, _ expected: Bool) {
77+
S1.Iterator.Element : Equatable {
78+
79+
8180
if a1.elementsEqual(a2) != expected {
8281
let un = expected ? "un" : ""
8382
print("unexpectedly \(un)equal sequences!")
8483
}
8584
}
8685

87-
func test<
88-
T : MyArrayProtocol
89-
where
86+
func test<T : MyArrayProtocol>(_: T.Type, _ label: String)
87+
where
9088
T.Iterator.Element == LifetimeTracked,
9189
T.Iterator.Element == T.Element,
9290
T.Index == Int,
93-
T.IndexDistance == Int
94-
>(_: T.Type, _ label: String) {
91+
T.IndexDistance == Int {
92+
9593
print("test: \(label)...", terminator: "")
9694

9795
var x: T = [

0 commit comments

Comments
 (0)