Skip to content

Commit f5de875

Browse files
committed
stdlib: remove Word and UWord
These types are leftovers from the early pre-1.0 times when Int and UInt were always 64-bit on all platforms. They serve no useful purpose today. Int and UInt are defined to be word-sized and should be used instead. rdar://18693488 Swift SVN r30564
1 parent ef553f4 commit f5de875

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1066
-1073
lines changed

stdlib/private/StdlibUnittest/CheckCollectionType.swift

+17-9
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public struct SubscriptRangeTest {
2929
public init(
3030
expected: [Int], collection: [Int], bounds: Range<Int>,
3131
count: Int,
32-
file: String = __FILE__, line: UWord = __LINE__
32+
file: String = __FILE__, line: UInt = __LINE__
3333
) {
3434
self.expected = expected.map(OpaqueValue.init)
3535
self.collection = collection.map(OpaqueValue.init)
@@ -45,8 +45,10 @@ public struct PrefixThroughTest {
4545
public let expected: [Int]
4646
public let loc: SourceLoc
4747

48-
init(collection: [Int], position: Int, expected: [Int],
49-
file: String = __FILE__, line: UWord = __LINE__) {
48+
init(
49+
collection: [Int], position: Int, expected: [Int],
50+
file: String = __FILE__, line: UInt = __LINE__
51+
) {
5052
self.collection = collection
5153
self.position = position
5254
self.expected = expected
@@ -60,8 +62,10 @@ public struct PrefixUpToTest {
6062
public let expected: [Int]
6163
public let loc: SourceLoc
6264

63-
public init(collection: [Int], end: Int, expected: [Int],
64-
file: String = __FILE__, line: UWord = __LINE__) {
65+
public init(
66+
collection: [Int], end: Int, expected: [Int],
67+
file: String = __FILE__, line: UInt = __LINE__
68+
) {
6569
self.collection = collection
6670
self.end = end
6771
self.expected = expected
@@ -75,8 +79,10 @@ internal struct RemoveFirstNTest {
7579
let expected: [Int]
7680
let loc: SourceLoc
7781

78-
init(collection: [Int], numberToRemove: Int, expected: [Int],
79-
file: String = __FILE__, line: UWord = __LINE__) {
82+
init(
83+
collection: [Int], numberToRemove: Int, expected: [Int],
84+
file: String = __FILE__, line: UInt = __LINE__
85+
) {
8086
self.collection = collection
8187
self.numberToRemove = numberToRemove
8288
self.expected = expected
@@ -90,8 +96,10 @@ public struct SuffixFromTest {
9096
public let expected: [Int]
9197
public let loc: SourceLoc
9298

93-
init(collection: [Int], start: Int, expected: [Int],
94-
file: String = __FILE__, line: UWord = __LINE__) {
99+
init(
100+
collection: [Int], start: Int, expected: [Int],
101+
file: String = __FILE__, line: UInt = __LINE__
102+
) {
95103
self.collection = collection
96104
self.start = start
97105
self.expected = expected

stdlib/private/StdlibUnittest/CheckMutableCollectionType.swift.gyb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public struct PartitionExhaustiveTest {
1717

1818
public init(
1919
_ sequence: [Int],
20-
file: String = __FILE__, line: UWord = __LINE__
20+
file: String = __FILE__, line: UInt = __LINE__
2121
) {
2222
self.sequence = sequence
2323
self.loc = SourceLoc(file, line, comment: "test data")

stdlib/private/StdlibUnittest/CheckRangeReplaceableCollectionType.swift

+11-11
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ internal struct ReplaceRangeTest {
6767
internal init(
6868
collection: [Int], newElements: [Int],
6969
rangeSelection: RangeSelection, expected: [Int],
70-
file: String = __FILE__, line: UWord = __LINE__
70+
file: String = __FILE__, line: UInt = __LINE__
7171
) {
7272
self.collection = collection.map(OpaqueValue.init)
7373
self.newElements = newElements.map(OpaqueValue.init)
@@ -85,7 +85,7 @@ internal struct AppendTest {
8585

8686
internal init(
8787
collection: [Int], newElement: Int, expected: [Int],
88-
file: String = __FILE__, line: UWord = __LINE__
88+
file: String = __FILE__, line: UInt = __LINE__
8989
) {
9090
self.collection = collection.map(OpaqueValue.init)
9191
self.newElement = OpaqueValue(newElement)
@@ -102,7 +102,7 @@ internal struct ExtendTest {
102102

103103
internal init(
104104
collection: [Int], newElements: [Int], expected: [Int],
105-
file: String = __FILE__, line: UWord = __LINE__
105+
file: String = __FILE__, line: UInt = __LINE__
106106
) {
107107
self.collection = collection.map(OpaqueValue.init)
108108
self.newElements = newElements.map(OpaqueValue.init)
@@ -120,7 +120,7 @@ internal struct InsertTest {
120120

121121
internal init(
122122
collection: [Int], newElement: Int, indexSelection: IndexSelection,
123-
expected: [Int], file: String = __FILE__, line: UWord = __LINE__
123+
expected: [Int], file: String = __FILE__, line: UInt = __LINE__
124124
) {
125125
self.collection = collection.map(OpaqueValue.init)
126126
self.newElement = OpaqueValue(newElement)
@@ -139,7 +139,7 @@ internal struct SpliceTest {
139139

140140
internal init(
141141
collection: [Int], newElements: [Int], indexSelection: IndexSelection,
142-
expected: [Int], file: String = __FILE__, line: UWord = __LINE__
142+
expected: [Int], file: String = __FILE__, line: UInt = __LINE__
143143
) {
144144
self.collection = collection.map(OpaqueValue.init)
145145
self.newElements = newElements.map(OpaqueValue.init)
@@ -159,7 +159,7 @@ internal struct RemoveAtIndexTest {
159159
internal init(
160160
collection: [Int], indexSelection: IndexSelection,
161161
expectedRemovedElement: Int, expectedCollection: [Int],
162-
file: String = __FILE__, line: UWord = __LINE__
162+
file: String = __FILE__, line: UInt = __LINE__
163163
) {
164164
self.collection = collection.map(OpaqueValue.init)
165165
self.indexSelection = indexSelection
@@ -177,7 +177,7 @@ internal struct RemoveLastTest {
177177

178178
internal init(
179179
collection: [Int], expectedRemovedElement: Int, expectedCollection: [Int],
180-
file: String = __FILE__, line: UWord = __LINE__
180+
file: String = __FILE__, line: UInt = __LINE__
181181
) {
182182
self.collection = collection.map(OpaqueValue.init)
183183
self.expectedRemovedElement = expectedRemovedElement
@@ -194,7 +194,7 @@ internal struct RemoveRangeTest {
194194

195195
internal init(
196196
collection: [Int], rangeSelection: RangeSelection, expected: [Int],
197-
file: String = __FILE__, line: UWord = __LINE__
197+
file: String = __FILE__, line: UInt = __LINE__
198198
) {
199199
self.collection = collection.map(OpaqueValue.init)
200200
self.rangeSelection = rangeSelection
@@ -210,7 +210,7 @@ internal struct RemoveAllTest {
210210

211211
internal init(
212212
collection: [Int], expected: [Int],
213-
file: String = __FILE__, line: UWord = __LINE__
213+
file: String = __FILE__, line: UInt = __LINE__
214214
) {
215215
self.collection = collection.map(OpaqueValue.init)
216216
self.expected = expected
@@ -225,7 +225,7 @@ internal struct ReserveCapacityTest {
225225

226226
internal init(
227227
collection: [Int], requestedCapacity: Int,
228-
file: String = __FILE__, line: UWord = __LINE__
228+
file: String = __FILE__, line: UInt = __LINE__
229229
) {
230230
self.collection = collection.map(OpaqueValue.init)
231231
self.requestedCapacity = requestedCapacity
@@ -241,7 +241,7 @@ internal struct OperatorPlusTest {
241241

242242
internal init(
243243
lhs: [Int], rhs: [Int], expected: [Int],
244-
file: String = __FILE__, line: UWord = __LINE__
244+
file: String = __FILE__, line: UInt = __LINE__
245245
) {
246246
self.lhs = lhs.map(OpaqueValue.init)
247247
self.rhs = rhs.map(OpaqueValue.init)

stdlib/private/StdlibUnittest/CheckSequenceType.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public struct FindTest {
2020
public init(
2121
expected: Int?, element: Int, sequence: [Int],
2222
expectedLeftoverSequence: [Int],
23-
file: String = __FILE__, line: UWord = __LINE__
23+
file: String = __FILE__, line: UInt = __LINE__
2424
) {
2525
self.expected = expected
2626
self.element = MinimalEquatableValue(element)
@@ -38,7 +38,7 @@ public struct DropFirstTest {
3838
public let loc: SourceLoc
3939

4040
public init(sequence: [Int], dropElements: Int, expected: [Int],
41-
file: String = __FILE__, line: UWord = __LINE__) {
41+
file: String = __FILE__, line: UInt = __LINE__) {
4242
self.sequence = sequence
4343
self.dropElements = dropElements
4444
self.expected = expected
@@ -53,7 +53,7 @@ public struct DropLastTest {
5353
public let loc: SourceLoc
5454

5555
public init(sequence: [Int], dropElements: Int, expected: [Int],
56-
file: String = __FILE__, line: UWord = __LINE__) {
56+
file: String = __FILE__, line: UInt = __LINE__) {
5757
self.sequence = sequence
5858
self.dropElements = dropElements
5959
self.expected = expected
@@ -68,7 +68,7 @@ public struct PrefixTest {
6868
public let loc: SourceLoc
6969

7070
public init(sequence: [Int], maxLength: Int, expected: [Int],
71-
file: String = __FILE__, line: UWord = __LINE__) {
71+
file: String = __FILE__, line: UInt = __LINE__) {
7272
self.sequence = sequence
7373
self.maxLength = maxLength
7474
self.expected = expected
@@ -83,7 +83,7 @@ public struct SuffixTest {
8383
public let loc: SourceLoc
8484

8585
public init(sequence: [Int], maxLength: Int, expected: [Int],
86-
file: String = __FILE__, line: UWord = __LINE__) {
86+
file: String = __FILE__, line: UInt = __LINE__) {
8787
self.sequence = sequence
8888
self.maxLength = maxLength
8989
self.expected = expected
@@ -100,7 +100,7 @@ public struct SplitTest {
100100
public let loc: SourceLoc
101101

102102
public init(sequence: [Int], maxSplit: Int, separator: Int, expected: [[Int]],
103-
allowEmptySlices: Bool, file: String = __FILE__, line: UWord = __LINE__) {
103+
allowEmptySlices: Bool, file: String = __FILE__, line: UInt = __LINE__) {
104104
self.sequence = sequence
105105
self.maxSplit = maxSplit
106106
self.separator = separator
@@ -396,7 +396,7 @@ internal struct ForEachTest {
396396

397397
init(
398398
_ sequence: [Int],
399-
file: String = __FILE__, line: UWord = __LINE__
399+
file: String = __FILE__, line: UInt = __LINE__
400400
) {
401401
self.sequence = sequence
402402
self.loc = SourceLoc(file, line, comment: "test data")

stdlib/private/StdlibUnittest/LoggingWrappers.swift.gyb

+2-2
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ public func expectCustomizable<
465465
@autoclosure _ message: ()->String = "",
466466
showFrame: Bool = true,
467467
stackTrace: SourceLocStack = SourceLocStack(),
468-
file: String = __FILE__, line: UWord = __LINE__
468+
file: String = __FILE__, line: UInt = __LINE__
469469
) {
470470
let newTrace = stackTrace.pushIf(showFrame, file: file, line: line)
471471
expectNotEqual(0, counters[T.self], message(), stackTrace: newTrace)
@@ -483,7 +483,7 @@ public func expectNotCustomizable<
483483
@autoclosure _ message: ()->String = "",
484484
showFrame: Bool = true,
485485
stackTrace: SourceLocStack = SourceLocStack(),
486-
file: String = __FILE__, line: UWord = __LINE__
486+
file: String = __FILE__, line: UInt = __LINE__
487487
) {
488488
let newTrace = stackTrace.pushIf(showFrame, file: file, line: line)
489489
expectNotEqual(0, counters[T.self], message(), stackTrace: newTrace)

stdlib/private/StdlibUnittest/OpaqueIdentityFunctions.swift

-6
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ public func getInt64(x: Int64) -> Int64 { return _opaqueIdentity(x) }
4949
@inline(never)
5050
public func getInt(x: Int) -> Int { return _opaqueIdentity(x) }
5151

52-
@inline(never)
53-
public func getWord(x: Word) -> Word { return _opaqueIdentity(x) }
54-
5552
@inline(never)
5653
public func getUInt8(x: UInt8) -> UInt8 { return _opaqueIdentity(x) }
5754

@@ -67,9 +64,6 @@ public func getUInt64(x: UInt64) -> UInt64 { return _opaqueIdentity(x) }
6764
@inline(never)
6865
public func getUInt(x: UInt) -> UInt { return _opaqueIdentity(x) }
6966

70-
@inline(never)
71-
public func getUWord(x: UWord) -> UWord { return _opaqueIdentity(x) }
72-
7367
@inline(never)
7468
public func getFloat32(x: Float32) -> Float32 { return _opaqueIdentity(x) }
7569

0 commit comments

Comments
 (0)