[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:
Doug Gregor
2016-07-19 11:24:54 -07:00
parent c7facf12b2
commit 0bf7c005b3
17 changed files with 268 additions and 225 deletions

View File

@@ -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
}
}
}