Kill off [_]RawOptionSetType

Now that we are using OptionSetType for option sets, all the support for
doing things the old way can die.

Note: the fix-it that used to apply to RawOptionSetType, it seemed to me,
should still apply to OptionSetType, so I switched it over instead of
removing it.

Swift SVN r29066
This commit is contained in:
Dave Abrahams
2015-05-27 15:55:54 +00:00
parent 8efffef57b
commit d65f696344
12 changed files with 14 additions and 381 deletions

View File

@@ -46,20 +46,6 @@ public protocol RawRepresentable {
var rawValue: RawValue { get }
}
// Workaround for our lack of circular conformance checking. Allow == to be
// defined on _RawOptionSetType in order to satisfy the Equatable requirement of
// RawOptionSetType without a circularity our type-checker can't yet handle.
/// This protocol is an implementation detail of `RawOptionSetType`; do
/// not use it directly.
///
/// Its requirements are inherited by `RawOptionSetType` and thus must
/// be satisfied by types conforming to that protocol.
public protocol _RawOptionSetType : RawRepresentable, Equatable {
typealias RawValue : BitwiseOperationsType, Equatable
init(rawValue: RawValue)
}
/// Returns `true` iff `lhs.rawValue == rhs.rawValue`.
public func == <
T : RawRepresentable where T.RawValue : Equatable
@@ -83,33 +69,6 @@ public func != <
return lhs.rawValue != rhs.rawValue
}
public func == <T : _RawOptionSetType>(a: T, b: T) -> Bool {
return a.rawValue == b.rawValue
}
public func & <T : _RawOptionSetType>(a: T, b: T) -> T {
return T(rawValue: a.rawValue & b.rawValue)
}
public func | <T : _RawOptionSetType>(a: T, b: T) -> T {
return T(rawValue: a.rawValue | b.rawValue)
}
public func ^ <T : _RawOptionSetType>(a: T, b: T) -> T {
return T(rawValue: a.rawValue ^ b.rawValue)
}
public prefix func ~ <T : _RawOptionSetType>(a: T) -> T {
return T(rawValue: ~a.rawValue)
}
/// Protocol for `NS_OPTIONS` imported from Objective-C.
public protocol RawOptionSetType : _RawOptionSetType, BitwiseOperationsType,
NilLiteralConvertible {
// FIXME: Disabled pending <rdar://problem/14011860> (Default
// implementations in protocols)
// The Clang importer synthesizes these for imported NS_OPTIONS.
/* init?(rawValue: RawValue) { self.init(rawValue) } */
}
/// Conforming types can be initialized with `nil`.
public protocol NilLiteralConvertible {
/// Create an instance initialized with `nil`.