mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Windows: bridge BOOL to Bool
This allows the conversion of the Windows `BOOL` type to be converted to `Bool` implicitly. The implicit bridging allows for a more ergonomic use of the native Windows APIs in Swift. Due to the ambiguity between the Objective C `BOOL` and the Windows `BOOL`, we must manually map the `BOOL` type to the appropriate type. This required lifting the mapping entry for `ObjCBool` from the mapped types XMACRO definition into the inline definition in the importer. Take the opportunity to simplify the mapping code. Adjust the standard library usage of the `BOOL` type which is now eclipsed by the new `WindowsBool` type, preferring to use `Bool` whenever possible. Thanks to Jordan Rose for the suggestion to do this and a couple of hints along the way.
This commit is contained in:
@@ -350,9 +350,9 @@ public protocol _ExpressibleByBuiltinBooleanLiteral {
|
||||
/// A type that can be initialized with the Boolean literals `true` and
|
||||
/// `false`.
|
||||
///
|
||||
/// Only three types provided by Swift---`Bool`, `DarwinBoolean`, and
|
||||
/// `ObjCBool`---are treated as Boolean values. Expanding this set to include
|
||||
/// types that represent more than simple Boolean values is discouraged.
|
||||
/// `Bool`, `DarwinBoolean`, `ObjCBool`, and `WindowsBool` are treated as
|
||||
/// Boolean values. Expanding this set to include types that represent more than
|
||||
/// simple Boolean values is discouraged.
|
||||
///
|
||||
/// To add `ExpressibleByBooleanLiteral` conformance to your custom type,
|
||||
/// implement the `init(booleanLiteral:)` initializer that creates an instance
|
||||
|
||||
Reference in New Issue
Block a user