Skip to content

Commit d6e5c2d

Browse files
authored
Merge pull request #980 from rintaro/newtype-comparable
2 parents b707ecf + 263b74e commit d6e5c2d

File tree

9 files changed

+17
-72
lines changed

9 files changed

+17
-72
lines changed

Foundation/FileManager.swift

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ extension FileManager {
774774
}
775775
}
776776

777-
public struct FileAttributeKey : RawRepresentable, Equatable, Hashable, Comparable {
777+
public struct FileAttributeKey : RawRepresentable, Equatable, Hashable {
778778
public let rawValue: String
779779

780780
public init(_ rawValue: String) {
@@ -793,10 +793,6 @@ public struct FileAttributeKey : RawRepresentable, Equatable, Hashable, Comparab
793793
return lhs.rawValue == rhs.rawValue
794794
}
795795

796-
public static func <(_ lhs: FileAttributeKey, _ rhs: FileAttributeKey) -> Bool {
797-
return lhs.rawValue < rhs.rawValue
798-
}
799-
800796
public static let type = FileAttributeKey(rawValue: "NSFileType")
801797
public static let size = FileAttributeKey(rawValue: "NSFileSize")
802798
public static let modificationDate = FileAttributeKey(rawValue: "NSFileModificationDate")
@@ -822,7 +818,7 @@ public struct FileAttributeKey : RawRepresentable, Equatable, Hashable, Comparab
822818
public static let systemFreeNodes = FileAttributeKey(rawValue: "NSFileSystemFreeNodes")
823819
}
824820

825-
public struct FileAttributeType : RawRepresentable, Equatable, Hashable, Comparable {
821+
public struct FileAttributeType : RawRepresentable, Equatable, Hashable {
826822
public let rawValue: String
827823

828824
public init(_ rawValue: String) {
@@ -841,10 +837,6 @@ public struct FileAttributeType : RawRepresentable, Equatable, Hashable, Compara
841837
return lhs.rawValue == rhs.rawValue
842838
}
843839

844-
public static func <(_ lhs: FileAttributeType, _ rhs: FileAttributeType) -> Bool {
845-
return lhs.rawValue < rhs.rawValue
846-
}
847-
848840
public static let typeDirectory = FileAttributeType(rawValue: "NSFileTypeDirectory")
849841
public static let typeRegular = FileAttributeType(rawValue: "NSFileTypeRegular")
850842
public static let typeSymbolicLink = FileAttributeType(rawValue: "NSFileTypeSymbolicLink")

Foundation/NSDecimalNumber.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//
99

1010
/*************** Exceptions ***********/
11-
public struct NSExceptionName : RawRepresentable, Equatable, Hashable, Comparable {
11+
public struct NSExceptionName : RawRepresentable, Equatable, Hashable {
1212
public private(set) var rawValue: String
1313

1414
public init(_ rawValue: String) {
@@ -26,10 +26,6 @@ public struct NSExceptionName : RawRepresentable, Equatable, Hashable, Comparabl
2626
public static func ==(_ lhs: NSExceptionName, _ rhs: NSExceptionName) -> Bool {
2727
return lhs.rawValue == rhs.rawValue
2828
}
29-
30-
public static func <(_ lhs: NSExceptionName, _ rhs: NSExceptionName) -> Bool {
31-
return lhs.rawValue < rhs.rawValue
32-
}
3329
}
3430

3531
extension NSExceptionName {

Foundation/NSHTTPCookie.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
88
//
99

10-
public struct HTTPCookiePropertyKey : RawRepresentable, Equatable, Hashable, Comparable {
10+
public struct HTTPCookiePropertyKey : RawRepresentable, Equatable, Hashable {
1111
public private(set) var rawValue: String
1212

1313
public init(_ rawValue: String) {
@@ -25,10 +25,6 @@ public struct HTTPCookiePropertyKey : RawRepresentable, Equatable, Hashable, Com
2525
public static func ==(_ lhs: HTTPCookiePropertyKey, _ rhs: HTTPCookiePropertyKey) -> Bool {
2626
return lhs.rawValue == rhs.rawValue
2727
}
28-
29-
public static func <(_ lhs: HTTPCookiePropertyKey, _ rhs: HTTPCookiePropertyKey) -> Bool {
30-
return rhs.rawValue == rhs.rawValue
31-
}
3228
}
3329

3430
extension HTTPCookiePropertyKey {

Foundation/NSLocale.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ extension NSLocale {
194194

195195
extension NSLocale {
196196

197-
public struct Key : RawRepresentable, Equatable, Hashable, Comparable {
197+
public struct Key : RawRepresentable, Equatable, Hashable {
198198
public private(set) var rawValue: String
199199
public init(rawValue: String) {
200200
self.rawValue = rawValue
@@ -240,10 +240,6 @@ extension NSLocale.Key {
240240
public static func ==(_ lhs: NSLocale.Key, _ rhs: NSLocale.Key) -> Bool {
241241
return lhs.rawValue == rhs.rawValue
242242
}
243-
244-
public static func <(_ lhs: NSLocale.Key, _ rhs: NSLocale.Key) -> Bool {
245-
return lhs.rawValue < rhs.rawValue
246-
}
247243
}
248244

249245

Foundation/NSNotification.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//
99

1010
open class NSNotification: NSObject, NSCopying, NSCoding {
11-
public struct Name : RawRepresentable, Equatable, Hashable, Comparable {
11+
public struct Name : RawRepresentable, Equatable, Hashable {
1212
public private(set) var rawValue: String
1313
public init(rawValue: String) {
1414
self.rawValue = rawValue
@@ -21,10 +21,6 @@ open class NSNotification: NSObject, NSCopying, NSCoding {
2121
public static func ==(lhs: Name, rhs: Name) -> Bool {
2222
return lhs.rawValue == rhs.rawValue
2323
}
24-
25-
public static func <(lhs: Name, rhs: Name) -> Bool {
26-
return lhs.rawValue < rhs.rawValue
27-
}
2824
}
2925

3026
private(set) open var name: Name

Foundation/NSRunLoop.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import CoreFoundation
1919
internal let kCFRunLoopAllActivities = CFRunLoopActivity.allActivities.rawValue
2020
#endif
2121

22-
public struct RunLoopMode : RawRepresentable, Equatable, Hashable, Comparable {
22+
public struct RunLoopMode : RawRepresentable, Equatable, Hashable {
2323
public private(set) var rawValue: String
2424

2525
public init(_ rawValue: String) {
@@ -37,10 +37,6 @@ public struct RunLoopMode : RawRepresentable, Equatable, Hashable, Comparable {
3737
public static func ==(_ lhs: RunLoopMode, _ rhs: RunLoopMode) -> Bool {
3838
return lhs.rawValue == rhs.rawValue
3939
}
40-
41-
public static func <(_ lhs: RunLoopMode, _ rhs: RunLoopMode) -> Bool {
42-
return lhs.rawValue < rhs.rawValue
43-
}
4440
}
4541

4642

Foundation/NSStream.swift

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal extension UInt {
1818
#endif
1919

2020
extension Stream {
21-
public struct PropertyKey : RawRepresentable, Equatable, Hashable, Comparable {
21+
public struct PropertyKey : RawRepresentable, Equatable, Hashable {
2222
public private(set) var rawValue: String
2323

2424
public init(_ rawValue: String) {
@@ -36,10 +36,6 @@ extension Stream {
3636
public static func ==(lhs: Stream.PropertyKey, rhs: Stream.PropertyKey) -> Bool {
3737
return lhs.rawValue == rhs.rawValue
3838
}
39-
40-
public static func <(lhs: Stream.PropertyKey, rhs: Stream.PropertyKey) -> Bool {
41-
return lhs.rawValue < rhs.rawValue
42-
}
4339
}
4440

4541
public enum Status : UInt {
@@ -262,7 +258,7 @@ extension Stream.PropertyKey {
262258
}
263259

264260
// MARK: -
265-
public struct StreamSocketSecurityLevel : RawRepresentable, Equatable, Hashable, Comparable {
261+
public struct StreamSocketSecurityLevel : RawRepresentable, Equatable, Hashable {
266262
public let rawValue: String
267263
public init(rawValue: String) {
268264
self.rawValue = rawValue
@@ -273,9 +269,6 @@ public struct StreamSocketSecurityLevel : RawRepresentable, Equatable, Hashable,
273269
public static func ==(lhs: StreamSocketSecurityLevel, rhs: StreamSocketSecurityLevel) -> Bool {
274270
return lhs.rawValue == rhs.rawValue
275271
}
276-
public static func <(lhs: StreamSocketSecurityLevel, rhs: StreamSocketSecurityLevel) -> Bool {
277-
return lhs.rawValue < rhs.rawValue
278-
}
279272
}
280273
extension StreamSocketSecurityLevel {
281274
public static let none = StreamSocketSecurityLevel(rawValue: "kCFStreamSocketSecurityLevelNone")
@@ -287,7 +280,7 @@ extension StreamSocketSecurityLevel {
287280

288281

289282
// MARK: -
290-
public struct StreamSOCKSProxyConfiguration : RawRepresentable, Equatable, Hashable, Comparable {
283+
public struct StreamSOCKSProxyConfiguration : RawRepresentable, Equatable, Hashable {
291284
public let rawValue: String
292285
public init(rawValue: String) {
293286
self.rawValue = rawValue
@@ -298,9 +291,6 @@ public struct StreamSOCKSProxyConfiguration : RawRepresentable, Equatable, Hasha
298291
public static func ==(lhs: StreamSOCKSProxyConfiguration, rhs: StreamSOCKSProxyConfiguration) -> Bool {
299292
return lhs.rawValue == rhs.rawValue
300293
}
301-
public static func <(lhs: StreamSOCKSProxyConfiguration, rhs: StreamSOCKSProxyConfiguration) -> Bool {
302-
return lhs.rawValue < rhs.rawValue
303-
}
304294
}
305295
extension StreamSOCKSProxyConfiguration {
306296
public static let hostKey = StreamSOCKSProxyConfiguration(rawValue: "NSStreamSOCKSProxyKey")
@@ -312,7 +302,7 @@ extension StreamSOCKSProxyConfiguration {
312302

313303

314304
// MARK: -
315-
public struct StreamSOCKSProxyVersion : RawRepresentable, Equatable, Hashable, Comparable {
305+
public struct StreamSOCKSProxyVersion : RawRepresentable, Equatable, Hashable {
316306
public let rawValue: String
317307
public init(rawValue: String) {
318308
self.rawValue = rawValue
@@ -323,9 +313,6 @@ public struct StreamSOCKSProxyVersion : RawRepresentable, Equatable, Hashable, C
323313
public static func ==(lhs: StreamSOCKSProxyVersion, rhs: StreamSOCKSProxyVersion) -> Bool {
324314
return lhs.rawValue == rhs.rawValue
325315
}
326-
public static func <(lhs: StreamSOCKSProxyVersion, rhs: StreamSOCKSProxyVersion) -> Bool {
327-
return lhs.rawValue < rhs.rawValue
328-
}
329316
}
330317
extension StreamSOCKSProxyVersion {
331318
public static let version4 = StreamSOCKSProxyVersion(rawValue: "kCFStreamSocketSOCKSVersion4")
@@ -334,7 +321,7 @@ extension StreamSOCKSProxyVersion {
334321

335322

336323
// MARK: - Supported network service types
337-
public struct StreamNetworkServiceTypeValue : RawRepresentable, Equatable, Hashable, Comparable {
324+
public struct StreamNetworkServiceTypeValue : RawRepresentable, Equatable, Hashable {
338325
public let rawValue: String
339326
public init(rawValue: String) {
340327
self.rawValue = rawValue
@@ -345,9 +332,6 @@ public struct StreamNetworkServiceTypeValue : RawRepresentable, Equatable, Hasha
345332
public static func ==(lhs: StreamNetworkServiceTypeValue, rhs: StreamNetworkServiceTypeValue) -> Bool {
346333
return lhs.rawValue == rhs.rawValue
347334
}
348-
public static func <(lhs: StreamNetworkServiceTypeValue, rhs: StreamNetworkServiceTypeValue) -> Bool {
349-
return lhs.rawValue < rhs.rawValue
350-
}
351335
}
352336
extension StreamNetworkServiceTypeValue {
353337
public static let voIP = StreamNetworkServiceTypeValue(rawValue: "kCFStreamNetworkServiceTypeVoIP")

Foundation/NSURL.swift

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ internal func _pathComponents(_ path: String?) -> [String]? {
6464
return nil
6565
}
6666

67-
public struct URLResourceKey : RawRepresentable, Equatable, Hashable, Comparable {
67+
public struct URLResourceKey : RawRepresentable, Equatable, Hashable {
6868
public private(set) var rawValue: String
6969
public init(rawValue: String) {
7070
self.rawValue = rawValue
@@ -81,10 +81,6 @@ public struct URLResourceKey : RawRepresentable, Equatable, Hashable, Comparable
8181
public static func ==(lhs: URLResourceKey, rhs: URLResourceKey) -> Bool {
8282
return lhs.rawValue == rhs.rawValue
8383
}
84-
85-
public static func <(lhs: URLResourceKey, rhs: URLResourceKey) -> Bool {
86-
return lhs.rawValue < rhs.rawValue
87-
}
8884
}
8985

9086
extension URLResourceKey {
@@ -190,7 +186,7 @@ extension URLResourceKey {
190186
}
191187

192188

193-
public struct URLFileResourceType : RawRepresentable, Equatable, Hashable, Comparable {
189+
public struct URLFileResourceType : RawRepresentable, Equatable, Hashable {
194190
public private(set) var rawValue: String
195191
public init(rawValue: String) {
196192
self.rawValue = rawValue
@@ -207,10 +203,6 @@ public struct URLFileResourceType : RawRepresentable, Equatable, Hashable, Compa
207203
public static func ==(lhs: URLFileResourceType, rhs: URLFileResourceType) -> Bool {
208204
return lhs.rawValue == rhs.rawValue
209205
}
210-
211-
public static func <(lhs: URLFileResourceType, rhs: URLFileResourceType) -> Bool {
212-
return lhs.rawValue < rhs.rawValue
213-
}
214206
}
215207

216208
extension URLFileResourceType {

Foundation/Progress.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,12 @@ open class Progress : NSObject {
401401
/// If the value of the `localizedDescription` property has not been set, then the default implementation of `localizedDescription` uses the progress kind to determine how to use the values of other properties, as well as values in the user info dictionary, to create a string that is presentable to the user.
402402
open var kind: ProgressKind?
403403

404-
public struct FileOperationKind : RawRepresentable, Equatable, Hashable, Comparable {
404+
public struct FileOperationKind : RawRepresentable, Equatable, Hashable {
405405
public let rawValue: String
406406
public init(_ rawValue: String) { self.rawValue = rawValue }
407407
public init(rawValue: String) { self.rawValue = rawValue }
408408
public var hashValue: Int { return self.rawValue.hashValue }
409409
public static func ==(_ lhs: FileOperationKind, _ rhs: FileOperationKind) -> Bool { return lhs.rawValue == rhs.rawValue }
410-
public static func <(_ lhs: FileOperationKind, _ rhs: FileOperationKind) -> Bool { return lhs.rawValue < rhs.rawValue }
411410

412411
/// Use for indicating the progress represents a download.
413412
public static let downloading = FileOperationKind(rawValue: "NSProgressFileOperationKindDownloading")
@@ -481,27 +480,25 @@ public protocol ProgressReporting : NSObjectProtocol {
481480
var progress: Progress { get }
482481
}
483482

484-
public struct ProgressKind : RawRepresentable, Equatable, Hashable, Comparable {
483+
public struct ProgressKind : RawRepresentable, Equatable, Hashable {
485484
public let rawValue: String
486485
public init(_ rawValue: String) { self.rawValue = rawValue }
487486
public init(rawValue: String) { self.rawValue = rawValue }
488487
public var hashValue: Int { return self.rawValue.hashValue }
489488
public static func ==(_ lhs: ProgressKind, _ rhs: ProgressKind) -> Bool { return lhs.rawValue == rhs.rawValue }
490-
public static func <(_ lhs: ProgressKind, _ rhs: ProgressKind) -> Bool { return lhs.rawValue < rhs.rawValue }
491489

492490
/// Indicates that the progress being performed is related to files.
493491
///
494492
/// Progress of this kind is assumed to use bytes as the unit of work being done and the default implementation of `localizedDescription` takes advantage of that to return more specific text than it could otherwise.
495493
public static let file = ProgressKind(rawValue: "NSProgressKindFile")
496494
}
497495

498-
public struct ProgressUserInfoKey : RawRepresentable, Equatable, Hashable, Comparable {
496+
public struct ProgressUserInfoKey : RawRepresentable, Equatable, Hashable {
499497
public let rawValue: String
500498
public init(_ rawValue: String) { self.rawValue = rawValue }
501499
public init(rawValue: String) { self.rawValue = rawValue }
502500
public var hashValue: Int { return self.rawValue.hashValue }
503501
public static func ==(_ lhs: ProgressUserInfoKey, _ rhs: ProgressUserInfoKey) -> Bool { return lhs.rawValue == rhs.rawValue }
504-
public static func <(_ lhs: ProgressUserInfoKey, _ rhs: ProgressUserInfoKey) -> Bool { return lhs.rawValue < rhs.rawValue }
505502

506503
/// How much time is probably left in the operation, as an NSNumber containing a number of seconds.
507504
///

0 commit comments

Comments
 (0)