mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SE-0091 Follow-up] Move global operators for non-generic concrete types into the type.
In various cases where we had global operators for non-generic concrete types (such as String + String), move those operators into the type. This should not affect the sources, but makes the exposition of the library cleaner. Plus, it's a good test for the compiler, which uncovered a few issues where the compiler was coupled with the library.
This commit is contained in:
@@ -31,21 +31,21 @@ public enum UnicodeDecodingResult : Equatable {
|
||||
|
||||
/// An indication of a decoding error.
|
||||
case error
|
||||
}
|
||||
|
||||
public func == (
|
||||
lhs: UnicodeDecodingResult,
|
||||
rhs: UnicodeDecodingResult
|
||||
) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case (.scalarValue(let lhsScalar), .scalarValue(let rhsScalar)):
|
||||
return lhsScalar == rhsScalar
|
||||
case (.emptyInput, .emptyInput):
|
||||
return true
|
||||
case (.error, .error):
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
public static func == (
|
||||
lhs: UnicodeDecodingResult,
|
||||
rhs: UnicodeDecodingResult
|
||||
) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case (.scalarValue(let lhsScalar), .scalarValue(let rhsScalar)):
|
||||
return lhsScalar == rhsScalar
|
||||
case (.emptyInput, .emptyInput):
|
||||
return true
|
||||
case (.error, .error):
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user